Back to Devexpress

SecuredEFCoreObjectSpaceProvider<TDbContext> Class

expressappframework-devexpress-dot-entityframeworkcore-dot-security-dot-securedefcoreobjectspaceprovider-1.md

latest3.4 KB
Original Source

SecuredEFCoreObjectSpaceProvider<TDbContext> Class

Provides an Object Space in EF Core-based applications that use the Security System.

Namespace : DevExpress.EntityFrameworkCore.Security

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

NuGet Package : DevExpress.ExpressApp.EFCore

Declaration

csharp
public class SecuredEFCoreObjectSpaceProvider<TDbContext> :
    EFCoreObjectSpaceProvider<TDbContext>,
    INonsecuredObjectSpaceProvider
    where TDbContext : DbContext
vb
Public Class SecuredEFCoreObjectSpaceProvider(Of TDbContext As DbContext)
    Inherits EFCoreObjectSpaceProvider(Of TDbContext)
    Implements INonsecuredObjectSpaceProvider

Type Parameters

NameDescription
TDbContext

The database provider

|

Remarks

The following example demonstrates how to create the SecuredEFCoreObjectSpaceProvider in a non-XAF application.

csharp
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.UseConnectionString(connectionString)
        );
        // ...
    }
}

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).

Implements

IObjectSpaceProvider

INonsecuredObjectSpaceProvider

Inheritance

Object EFCoreObjectSpaceProvider<TDbContext> SecuredEFCoreObjectSpaceProvider<TDbContext>

See Also

SecuredEFCoreObjectSpaceProvider<TDbContext> Members

DevExpress.EntityFrameworkCore.Security Namespace