Skip to main content
All docs
V25.2
  • EFCoreObjectSpaceProviderOptionsBuilder.CustomCreateObjectSpaceProvider Property

    Allows you to create a custom Object Space provider.

    Namespace: DevExpress.ExpressApp.ApplicationBuilder

    Assembly: DevExpress.ExpressApp.EFCore.v25.2.dll

    NuGet Package: DevExpress.ExpressApp.EFCore

    Declaration

    public Func<CustomCreateObjectSpaceProviderContext, IObjectSpaceProvider> CustomCreateObjectSpaceProvider { get; set; }

    Property Value

    Type Description
    Func<CustomCreateObjectSpaceProviderContext, IObjectSpaceProvider>

    A delegate that accepts an instance of CustomCreateObjectSpaceProviderContext and must return the custom Object Space provider.

    Remarks

    You can use this delegate to create a custom Object Space provider in WinForms, Blazor, and WebAPI applications that use Integrated Security, Middle Tier Security, or no security.

    builder.ObjectSpaceProviders 
        .AddSecuredEFCore(o => { 
            // ... 
            o.CustomCreateObjectSpaceProvider = (context) => { 
                var selectDataSecurityProvider = context.ServiceProvider.GetRequiredService<ISelectDataSecurityProvider>(); 
                var dbContextFactory = context.ServiceProvider.GetRequiredService<IDbContextFactory<MainDemoDbContext>>(); 
                return new MyCustomEFCoreObjectSpaceProvider<ApplicationDbContext>(...); 
            }; 
        }) 
        .WithDbContext<ApplicationDbContext>(...) 
    
    See Also