Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataSourceBase.CreateObjectSpace(Type, IServiceProvider) Method

Creates an Object Space.

Namespace: DevExpress.Persistent.Base.ReportsV2

Assembly: DevExpress.Persistent.Base.v24.2.dll

#Declaration

public static IObjectSpace CreateObjectSpace(
    Type dataType,
    IServiceProvider serviceProvider
)

#Parameters

Name Type Description
dataType Type

A Type object that specifies the business object type for which the Object Space is retrieved.

serviceProvider IServiceProvider

An IServiceProvider object.

#Returns

Type Description
IObjectSpace

An IObjectSpace object.

#Remarks

To access data in an XAF application, you do not need to use an ORM-specific context or query data from the database directly. Instead of these techniques, use an Object Space’s methods (see Data Manipulation and Business Logic).

The CreateObjectSpace static method allows you to access an Object Space in report scripts:

private void report_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    DevExpress.ExpressApp.IObjectSpace objectSpace = 
        DevExpress.Persistent.Base.ReportsV2.DataSourceBase.CreateObjectSpace(typeof(MyObject), (DevExpress.XtraReports.UI.XtraReport)sender);
}
See Also