Skip to main content
.NET 8.0+
  • The page you are viewing does not exist in the .NET Framework 4.6.2+ platform documentation. This link will take you to the parent topic of the current section.

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

SecuredEFCoreObjectSpace Class

An Object Space for EF Core-based applications that use the Security System.

Namespace: DevExpress.EntityFrameworkCore.Security

Assembly: DevExpress.EntityFrameworkCore.Security.v24.2.dll

NuGet Package: DevExpress.ExpressApp.EFCore

#Declaration

public class SecuredEFCoreObjectSpace :
    EFCoreObjectSpace,
    ISessionObjectProvider

#Remarks

XAF creates Object Spaces of the SecuredEFCoreObjectSpace type in the following cases:

The following example demonstrates how to use SecuredEFCoreObjectSpaceProvider<TDbContext> to create SecuredEFCoreObjectSpace in a non-XAF application.

using DevExpress.EntityFrameworkCore.Security;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl.EF.PermissionPolicy;
using Microsoft.EntityFrameworkCore;
using System.Configuration;
// ...
class Program {
    static void Main() {
        AuthenticationStandard authentication = new AuthenticationStandard();
        SecurityStrategyComplex security = new SecurityStrategyComplex(
            typeof(PermissionPolicyUser), typeof(PermissionPolicyRole),
            authentication
        );
        var objectSpaceProvider = new SecuredEFCoreObjectSpaceProvider<ApplicationDbContext>(security,
            XafTypesInfo.Instance, ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString,
            (builder, connectionString) => builder.UseSqlServer(connectionString)
        );
        // ...
        IObjectSpace securedObjectSpace = objectSpaceProvider.CreateObjectSpace();
    }
}

You can find the full example in the following GitHub repository: How to use the Integrated mode of the Security System in non-XAF applications (EF Core).

For more information on Object Space and Object Space Provider types, refer to the following topics:

#Implements

See Also