Skip to main content
All docs
V24.1
.NET 6.0+
  • The page you are viewing does not exist in the .NET Framework 4.5.2+ platform documentation. This link will take you to the parent topic of the current section.

XPObjectSpaceProviderBuilderExtensions.AddXpo<TContext>(IObjectSpaceProviderBuilder<TContext>, Action<XafApplication, XPObjectSpaceProviderOptions>) Method

Adds the XPObjectSpaceProvider to your WinForms application.

Namespace: DevExpress.ExpressApp.ApplicationBuilder

Assembly: DevExpress.ExpressApp.Xpo.v24.1.dll

NuGet Package: DevExpress.ExpressApp.Xpo

Declaration

public static IObjectSpaceProviderBuilder<TContext> AddXpo<TContext>(
    this IObjectSpaceProviderBuilder<TContext> builder,
    Action<XafApplication, XPObjectSpaceProviderOptions> configureOptions
)
    where TContext : IXafApplicationBuilder<TContext>, IAccessor<IServiceCollection>

Parameters

Name Type Description
builder IObjectSpaceProviderBuilder<TContext>

Allows you to register and configure Object Space Providers in your application, and chain further provider registrations.

configureOptions Action<XafApplication, XPObjectSpaceProviderOptions>

Options that you can use to configure the XPO Object Space Provider.

Type Parameters

Name Description
TContext

The IWinApplicationBuilder type.

Returns

Type Description
IObjectSpaceProviderBuilder<TContext>

Allows you to register and configure Object Space Providers in your application, and chain further provider registrations.

Remarks

The following example demonstrates how to use this method:

File: MySolution.Win\Startup.cs.

using DevExpress.ExpressApp.ApplicationBuilder;
using DevExpress.ExpressApp.Win.ApplicationBuilder;
// ...
public class ApplicationBuilder : IDesignTimeApplicationFactory {
    public static WinApplication BuildApplication(string connectionString) {
        var builder = WinApplication.CreateBuilder();
        builder.UseApplication<MySolutionWindowsFormsApplication>();
        builder.ObjectSpaceProviders
            .AddXpo((application, options) => {
                options.ConnectionString = connectionString;
            })
            .AddNonPersistent();
    }
    // ...
}
See Also