The following example shows how to create objects of different types coming from the same data source.
Typically, to create an object, BLToolkit calls the TypeAccessor.CreateInstanceEx method. First of all, this method verifies if there is an object factory (ObjectFactory property) associated with the creating object’s type. If the property value is not null, it is used to create an object.
The ObjectFactory property can be assigned explicitly at any time or by decorating the target class with the ObjectFactory attribute.
ObjectFactory.cs <% ..\..\..\HowTo\Reflection\ObjectFactory.cs %> App.config <% Doc\Data\App.config %> Create.sql script