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

IObjectSpace Interface

Declares members implemented by Object Space.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll

Declaration

public interface IObjectSpace :
    IDisposable

The following members accept/return IObjectSpace objects:

Show 52 links

Remarks

For more information on the Object Space concept, refer to the following class description: BaseObjectSpace.

Follow the steps below to implement a custom Object Space:

  1. Create a new BaseObjectSpace descendant. BaseObjectSpace implements the IObjectSpace members that are not related to the data layer.
  2. Override BaseObjectSpace‘s protected virtual methods you want to customize.
  3. Implement the IObjectSpace members related to the data layer.

You can also inherit one of the BaseObjectSpace descendants.

The following article demonstrates how to create a custom Object Space class and register the custom Object Space Provider for it: How to customize the Object Space behavior in XPO-based XAF applications.

The following example demonstrates how to use the IObjectSpace methods:

using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.Persistent.BaseImpl;
using System;
using System.Collections.Generic;
using System.Linq;

//...
public void MethodInsideController(IObjectSpace objectSpace) {
    // In a ViewController, you can use the View.ObjectSpace property to access the current Object Space
    // or call the Application.CreateObjectSpace method to create a new Object Space.
    Person person = objectSpace.FirstOrDefault<Person>(p => p.FirstName == "John" && p.LastName == "Doe");
    if(person != null) {
        // IList<Task> outdatedTasks = objectSpace.GetObjects<Task>(CriteriaOperator.Parse("DueDate < ?", DateTime.Now));
        IQueryable<Task> outdatedTasks = objectSpace.GetObjectsQuery<Task>().Where(t => t.DueDate < DateTime.Now);
        foreach(Task task in outdatedTasks) {
            task.AssignedTo = person;
        }
    }
    objectSpace.CommitChanges();
}
//...

For more information on ways to access an Object Space in different scenarios, refer to the following help topic: Ways to Implement Business Logic. To learn about Object Space API, see Create, Read, Update and Delete Data.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IObjectSpace interface.

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