Skip to main content
.NET 8.0+

BaseObjectSpace.CreateObject<ObjectType>() Method

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

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public ObjectType CreateObject<ObjectType>()

Type Parameters

Name
ObjectType

Returns

Type Description
ObjectType

A created object of the specified type.

Remarks

This method calls a protected virtual method, CreateObjectCore, which must be overridden in the BaseObjectSpace class descendants. After an object of the specified type is created, the BaseObjectSpace.SetModified method is called so that the object is saved to the database during the next changes commit (see BaseObjectSpace.CommitChanges).

Use this method to create objects in Controllers. In a regular business class, create objects directly via their constructor.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreateObject<ObjectType>() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also