ObjectTypeManagerRegisterObjectType Method |
Namespace: CMS.DataEngine
public static void RegisterObjectType( string objectType, ObjectTypeInfo typeInfo, Type type, bool allowObjectTypeProviderRegistration = true )
Exception | Condition |
---|---|
ArgumentException | Thrown when object type is either null or empty. |
ArgumentNullException | Thrown when either type info or type is null. |
The method registers a corresponding IInfoProviderTInfo implementation into IoC container if typeInfo specifies the ProviderType to be registered and allowObjectTypeProviderRegistration is not false.
All object types must be registered during application pre-initialization. Registration into the IoC container cannot be performed after the container's initialization has finished.
Use the allowObjectTypeProviderRegistration parameter in scenarios when the IoC container is not available (i.e. unit tests). In such scenarios, the allowObjectTypeProviderRegistration must be false.