November Happy Hour will be moved to Thursday December 5th.

Interface IEntityTypeResolver

Interface that defines a service that resolves Entity types and identities.

Namespace: EPiServer.Data.Entity
Assembly: EPiServer.Data.dll
Version: 12.0.3
Syntax
public interface IEntityTypeResolver
Examples

Example that gets an ID of a type and then reads the same type back again by ID

        public void Sample()
{
IEntityTypeResolver resolver = ServiceLocator.Current.GetInstance<IEntityTypeResolver>();

//Get the ID for the type int typeID = resolver.GetTypeID(typeof(MyEntity));

//Get back the type of an ID Type type = resolver.GetTypeByID(typeID); }

Methods

GetTypeByID(Int32)

Gets the System.Type represented by id in the database.

Declaration
Type GetTypeByID(int id)
Parameters
Type Name Description
System.Int32 id

The ID for which to get the System.Type

Returns
Type Description
System.Type

The System.Type associated with the given id.

GetTypeID(Type, Boolean)

Gets the ID representing a System.Type in the database

Declaration
int GetTypeID(Type type, bool ignoreOverrideAttribute)
Parameters
Type Name Description
System.Type type

The System.Type for which to get the ID

System.Boolean ignoreOverrideAttribute

Whether to ignore the EntityTypeOverrideAttribute attribute.

Returns
Type Description
System.Int32

Returns the integer ID that represents the type in the database.

GetTypeName(Type, Boolean)

Gets the name of a System.Type as used in the database

Declaration
string GetTypeName(Type type, bool ignoreOverrideAttribute)
Parameters
Type Name Description
System.Type type

The System.Type to get the name for

System.Boolean ignoreOverrideAttribute

Whether to ignore the EntityTypeOverrideAttribute attribute.

Returns
Type Description
System.String

The type name.

Extension Methods