All docs
V21.1
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Standard 2.0+
.NET Framework 4.5.2+
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.
.NET Standard 2.0+
.NET Core 3.0+

SecuredEFCoreObjectSpace Class

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

Namespace: DevExpress.EntityFrameworkCore.Security

Assembly: DevExpress.EntityFrameworkCore.Security.v21.1.dll

Declaration

public class SecuredEFCoreObjectSpace :
    EFCoreObjectSpace,
    ISessionObjectProvider

Remarks

If your application does not use the Security System, create the EFCoreObjectSpace instead of SecuredEFCoreObjectSpace.

In XAF application, use the XafApplication.CreateObjectSpace method to create this Object Space if the default Object Space Provider is SecuredEFCoreObjectSpaceProvider (see the CreateDefaultObjectSpaceProvider method implementation of your WinApplication descendant).

The following example demonstrates how to use SecuredEFCoreObjectSpaceProvider 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
        );
        SecuredEFCoreObjectSpaceProvider objectSpaceProvider = new SecuredEFCoreObjectSpaceProvider(
            security, typeof(ApplicationDbContext),
            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).

To learn more about Object Spaces, refer to the BaseObjectSpace class description.

Implements

See Also