Class ObjectGenerator<TBase>
Generator class for the various type of objects
public class ObjectGenerator<TBase> where TBase : class
Type Parameters
TBase
- Inheritance
-
objectObjectGenerator<TBase>
- Extension Methods
Constructors
ObjectGenerator(IObjectFactory)
Constructor
public ObjectGenerator(IObjectFactory defaultFactory)
Parameters
defaultFactoryIObjectFactoryDefault factory that will be used if no object type matches
Methods
CreateNewObject(object)
Creates new object of the given type
public TBase CreateNewObject(object parameter = null)
Parameters
parameterobjectParameter used in CanCreateObject(object) method.
Returns
- TBase
CreateNewObject(string)
Creates new object of the given type
public TBase CreateNewObject(string objectType)
Parameters
objectTypestringObject type
Returns
- TBase
RegisterDefaultFactory(IObjectFactory, bool)
Registers the default object factory
public void RegisterDefaultFactory(IObjectFactory factory, bool topPriority)
Parameters
factoryIObjectFactoryObject factory to register
topPriorityboolIf true, this factory is prioritized against
RegisterObjectType(string, IObjectFactory)
Registers the given object type
public void RegisterObjectType(string objectType, IObjectFactory factory)
Parameters
objectTypestringObject type string
factoryIObjectFactoryObject factory
RegisterObjectType<TObject>(string)
Registers the given object type
public void RegisterObjectType<TObject>(string objectType) where TObject : class, TBase, new()
Parameters
objectTypestringObject type string
Type Parameters
TObject
UnregisterObjectType(string)
Unregisters the given object type.
public void UnregisterObjectType(string objectType)
Parameters
objectTypestringObject type string.