.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

XafApplication.ObjectSpaceProvider Property

Provides access to the application's Object Space Provider.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

[Browsable(false)]
public IObjectSpaceProvider ObjectSpaceProvider { get; }
<Browsable(False)>
Public ReadOnly Property ObjectSpaceProvider As IObjectSpaceProvider
[Browsable(false)]
public IObjectSpaceProvider ObjectSpaceProvider { get; }
<Browsable(False)>
Public ReadOnly Property ObjectSpaceProvider As IObjectSpaceProvider
[Browsable(false)]
public IObjectSpaceProvider ObjectSpaceProvider { get; }
<Browsable(False)>
Public ReadOnly Property ObjectSpaceProvider As IObjectSpaceProvider

Property Value

Type Description
IObjectSpaceProvider

An instance of the class that implements the IObjectSpaceProvider interface.

Property Value

Type Description
IObjectSpaceProvider

An instance of the class that implements the IObjectSpaceProvider interface.

Property Value

Type Description
IObjectSpaceProvider

An instance of the class that implements the IObjectSpaceProvider interface.

Remarks

XAF uses an Object Space Provider to create Object Spaces. It is a class that implements members of the IObjectSpaceProvider interface. The following Object Space Provider types are supplied with XAF.

By default, XPObjectSpaceProvider is created because the WinForms, ASP.NET and Mobile application project templates override the CreateDefaultObjectSpaceProvider method of the corresponding XafApplication descendant in the following manner:

public partial class MainDemoWinApplication : WinApplication {
//...
    protected override void CreateDefaultObjectSpaceProvider(
        CreateCustomObjectSpaceProviderEventArgs args) {
        args.ObjectSpaceProvider = new XPObjectSpaceProvider(args.ConnectionString, args.Connection);
    }
}

The CreateDefaultObjectSpaceProvider method is called when creating an Object Space Provider during the application's setup if a particular Object Space Provider is not passed as a parameter in the Setup method call. So, check that an Object Space Provider is not passed in your Setup method call, as in the following code.

static class Program {
    // ...
    public static void Main() {
        // ...
        MainDemoWinApplication application = new MainDemoWinApplication();
        // ...
        application.Setup();
        application.Start();
        // ...
    }
}

To create an Object Space Provider, the application uses the connection string specified using the XafApplication.ConnectionString property. If you need to specify a custom connection string or create an Object Space Provider of another type, implement a custom override of the CreateDefaultObjectSpaceProvider method. Alternatively, you can handle the XafApplication.CreateCustomObjectSpaceProvider event to pass a custom Object Space Provider.

Note

XAF uses the first registered Object Space Provider for the following purposes:

Ensure that NonPersistentObjectSpaceProvider is not the first registered Provider in your application.

See Also