Class ContentProviderBuilder
Used to configure and build up ContentProvider instances on the ContentOptions class.
Inheritance
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public class ContentProviderBuilder : Object
Constructors
ContentProviderBuilder(String, Type)
Initializes a new instance of the ContentProviderBuilder class.
Declaration
public ContentProviderBuilder(string name, Type providerType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the content provider |
| System.Type | providerType | The type of the provider instance. Must implement ContentProvider. |
Remarks
It's recommended to use the Create<TProvider>(String) method to initialize new instances as it will provide type support.
Properties
AutoCorrectInvalidName
Gets or sets if an invalid provider name should be automatically corrected or if an exception should be thrown.
Declaration
public bool AutoCorrectInvalidName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Name
Gets the name of the ContentProvider.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
ProviderType
Gets the type of the ContentProvider.
Declaration
public Type ProviderType { get; }
Property Value
| Type | Description |
|---|---|
| System.Type |
Methods
Build(IServiceProvider)
Builds a new ContentProvider instance.
Declaration
public ContentProvider Build(IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IServiceProvider | serviceProvider | The service provider used to create provider instances. |
Returns
| Type | Description |
|---|---|
| ContentProvider | A new ContentProvider instance. |
Configure<TProviderOptions>(Action<TProviderOptions>)
Adds a configuration of the provider.
Declaration
public ContentProviderBuilder Configure<TProviderOptions>(Action<TProviderOptions> configure)
where TProviderOptions : class, new()
Parameters
| Type | Name | Description |
|---|---|---|
| System.Action<TProviderOptions> | configure | A method used to configure the options for this provider. |
Returns
| Type | Description |
|---|---|
| ContentProviderBuilder |
Type Parameters
| Name | Description |
|---|---|
| TProviderOptions | The options type required by the provider configured by this instance. |
Create<TProvider>(String)
Factory method for creating a new ContentProviderBuilder instance.
Declaration
public static ContentProviderBuilder Create<TProvider>(string name)
where TProvider : ContentProvider
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the ContentProvider. |
Returns
| Type | Description |
|---|---|
| ContentProviderBuilder | A new ContentProviderBuilder instance. |
Type Parameters
| Name | Description |
|---|---|
| TProvider | Type of the provider instance. Must implement ContentProvider. |