Class ContentProviderBuilder
Used to configure and build up ContentProvider instances on the ContentOptions class.
Inheritance
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 11.20.7Syntax
public class ContentProviderBuilder
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
Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. 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(IServiceLocator)
Builds a new ContentProvider instance.
Declaration
public ContentProvider Build(IServiceLocator serviceLocator)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceLocator | serviceLocator | The service locator 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. |