Class EntityProviderHandler
Resolve and register IEntityProvider implementations for .NET types
Inheritance
Inherited Members
Namespace: EPiServer.Data.Entity
Assembly: EPiServer.Data.dll
Version: 7.19.2Syntax
public class EntityProviderHandler
Examples
Register an entity provider as follows:
Resolve an entity provider as follows:
Register an entity provider as follows when the type is not known at compile-time:
Constructors
EntityProviderHandler()
Initializes a new instance of this class.
Declaration
public EntityProviderHandler()
Properties
Instance
The globally available instance of the entity repository.
Declaration
public static EntityProviderHandler Instance { get; set; }
Property Value
Type | Description |
---|---|
EntityProviderHandler |
Remarks
This instance is being initialized by DataInitialization and will be null otherwise
Methods
GetEntityProvider(Type)
Gets the IEntityProvider that handles instantiation of the specified type
Declaration
public virtual IEntityProvider GetEntityProvider(Type entityType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | entityType | The System.Type that is required to be supported by the returned IEntityProvider |
Returns
Type | Description |
---|---|
IEntityProvider | Returns an instance of the IEntityProvider configured for the type requested in the
|
GetEntityProvider<TEntity>()
Gets the IEntityProvider that handles instantiation of the specified type
Declaration
public virtual IEntityProvider GetEntityProvider<TEntity>()
where TEntity : IEntity
Returns
Type | Description |
---|---|
IEntityProvider | Returns an instance of the IEntityProvider configured for the type requested in the
|
Type Parameters
Name | Description |
---|---|
TEntity | The type of the entity which you are requesting the provider for |
GetEntityReference(Guid)
Declaration
[Obsolete("This method has been moved to the IEntityResolver implementation, syntax: ServiceLocator.Current.GetInstance<IEntityResolver>().GetEntityReference(guid) .", false)]
public EntityReference GetEntityReference(Guid guid)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | guid |
Returns
Type | Description |
---|---|
EntityReference |
GetEntityUniqueID(EntityReference)
Declaration
[Obsolete("This Method has been moved to the IEntityResolver implementation, syntax: ServiceLocator.Current.GetInstance<IEntityResolver>().GetEntityUniqueID(er).", false)]
public Guid GetEntityUniqueID(EntityReference er)
Parameters
Type | Name | Description |
---|---|---|
EntityReference | er |
Returns
Type | Description |
---|---|
System.Guid |
GetTypeByID(Int32)
Declaration
[Obsolete("This Method has been moved to the IEntityTypeResolver implementation, syntax: ServiceLocator.Current.GetInstance<IEntityTypeResolver>().GetTypeByID(id).", false)]
public Type GetTypeByID(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
System.Type |
GetTypeID(Type, Boolean)
Declaration
[Obsolete("This Method has been moved to the IEntityTypeResolver implementation, syntax: ServiceLocator.Current.GetInstance<IEntityTypeResolver>().GetTypeID(type, ignoreOverrideAttribute)", false)]
public int GetTypeID(Type type, bool ignoreOverrideAttribute)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | |
System.Boolean | ignoreOverrideAttribute |
Returns
Type | Description |
---|---|
System.Int32 |
GetTypeName(Type)
Declaration
[Obsolete("This Method has been moved to the IEntityTypeResolver implementation, syntax: ServiceLocator.Current.GetInstance<IEntityTypeResolver>().GetTypeName(type)", false)]
public string GetTypeName(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type |
Returns
Type | Description |
---|---|
System.String |
GetTypeName(Type, Boolean)
Declaration
[Obsolete("This Method has been moved to the IEntityTypeResolver implementation, syntax: ServiceLocator.Current.GetInstance<IEntityTypeResolver>().GetTypeName(type, ignoreOverrideAttribute).", false)]
public string GetTypeName(Type type, bool ignoreOverrideAttribute)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | |
System.Boolean | ignoreOverrideAttribute |
Returns
Type | Description |
---|---|
System.String |
RegisterEntityProvider(IEntityProvider, Type[])
Registers a IEntityProvider that handles instantiation of the specified type
Declaration
public virtual void RegisterEntityProvider(IEntityProvider entityProvider, params Type[] supportedTypes)
Parameters
Type | Name | Description |
---|---|---|
IEntityProvider | entityProvider | The instance of the IEntityProvider configured for the types requested |
System.Type[] | supportedTypes | A list of System.Type that is supported by the IEntityProvider |
RegisterEntityProvider<TEntityProvider, TSupportedType>()
Registers a IEntityProvider that handles instantiation of the specified type
Declaration
public virtual void RegisterEntityProvider<TEntityProvider, TSupportedType>()
where TEntityProvider : IEntityProvider, new()
where TSupportedType : IEntity
Type Parameters
Name | Description |
---|---|
TEntityProvider | The instance of the IEntityProvider configured for the type requested |
TSupportedType | The System.Type that is required to be supported by the IEntityProvider |
Remarks
If an instance of TEntityProvider
is already added as a provider the TSupportedType
will point to the same instance.