.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

IObjectSpace.Delete(Object) Method

Marks the specified persistent object and its aggregated objects as deleted from a persistent storage.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll

Declaration

void Delete(
    object obj
)

Parameters

Name Type Description
obj Object

An object which is the persistent object to be deleted.

Remarks

Use this method to delete the object specified as the parameter from the database. Note, that the object is not deleted immediately. It is only marked as an object to be deleted during the next call of the IObjectSpace.CommitChanges method.

In the BaseObjectSpace class’s descendant, the Delete method is implemented. In this method, the IObjectSpace.CustomDeleteObjects event is raised, a protected virtual BaseObjectSpace.DeleteCore method is invoked and then the current Object Space is set as modified. Override the BaseObjectSpace.DeleteCore method to delete the specified object using the container for in-memory objects (e.g. XPObjectSpace.Session in the case of an XPObjectSpace or EFObjectSpace.ObjectContext in the case of an XPObjectSpace).

After this method call, the Object Space’s IObjectSpace.IsModified property is set to true.

Use the following code in a controller to delete the first selected object from the List View collection:

ObjectSpace.Delete(View.SelectedObjects[0]); 

The following code snippets (auto-collected from DevExpress Examples) contain references to the Delete(Object) 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