IObjectSpace.CreateObject<ObjectType>() Method

Creates an object of the type designated by the specified generic type parameter.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v18.2.dll


ObjectType CreateObject<ObjectType>()
Function CreateObject(Of ObjectType) As ObjectType


Type Description

A created object of the specified type.

Type Parameters

Name Description

Below is an example of using the CreateObject<ObjectType> method. Here, objectSpace is the Object Space instance which can be accessed as described in the Ways to Implement Business Logic topic.

Person person = objectSpace.CreateObject<Person>();

If you implement the IObjectSpace interface in the BaseObjectSpace class' descendant, you don't have to override the CreateObject<ObjectType> method entirely. The BaseObjectSpace.CreateObject<ObjectType> method invokes a protected virtual BaseObjectSpace.CreateObjectCore method and then sets the returned object modified by calling the BaseObjectSpace.SetModified method for it. So, you should only override the CreateObjectCore method.

The created object will be saved to the database when calling the IObjectSpace.CommitChanges method.

See Also