MasLazu.AspNet.Authorization.Page.EfCore 1.0.0-preview.1

This is a prerelease version of MasLazu.AspNet.Authorization.Page.EfCore.
dotnet add package MasLazu.AspNet.Authorization.Page.EfCore --version 1.0.0-preview.1
                    
NuGet\Install-Package MasLazu.AspNet.Authorization.Page.EfCore -Version 1.0.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MasLazu.AspNet.Authorization.Page.EfCore" Version="1.0.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MasLazu.AspNet.Authorization.Page.EfCore" Version="1.0.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="MasLazu.AspNet.Authorization.Page.EfCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MasLazu.AspNet.Authorization.Page.EfCore --version 1.0.0-preview.1
                    
#r "nuget: MasLazu.AspNet.Authorization.Page.EfCore, 1.0.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MasLazu.AspNet.Authorization.Page.EfCore@1.0.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MasLazu.AspNet.Authorization.Page.EfCore&version=1.0.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MasLazu.AspNet.Authorization.Page.EfCore&version=1.0.0-preview.1&prerelease
                    
Install as a Cake Tool

MasLazu.AspNet.Authorization.Page.EfCore

This project provides Entity Framework Core integration for the ASP.NET Authorization Page system. It includes database context configuration, entity type configurations, and dependency injection setup for data persistence.

Overview

The EF Core layer handles the mapping between domain entities and database tables, including relationships, constraints, and indexes. It provides the database context that applications use to interact with the underlying data store.

Key Components

Database Context

  • AuthorizationPageDbContext: The main EF Core database context that inherits from BaseDbContext
    • Contains DbSet properties for Pages, PageGroups, and PagePermissions
    • Applies entity configurations in OnModelCreating

Entity Configurations

Fluent API configurations for each entity:

PageConfiguration

Configures the Page entity:

  • Primary key: Id
  • Properties: Code (required, max 50, unique), Name (required, max 100), Path (required, max 500, indexed)
  • Relationships:
    • Self-referencing Parent relationship (optional, set null on delete)
    • PageGroup relationship (optional, set null on delete)
    • PagePermissions collection (cascade delete)
  • Indexes: Unique on Code, standard on Path
PageGroupConfiguration

Configures the PageGroup entity:

  • Primary key: Id
  • Properties: Code (required, max 50, unique), Name (required, max 100), Icon (optional, max 100)
  • Relationships: Pages collection (set null on delete)
  • Indexes: Unique on Code
PagePermissionConfiguration

Configures the PagePermission entity:

  • Primary key: Id
  • Properties: PageId (required), PermissionId (required)
  • Relationships: Page relationship (cascade delete)
  • Indexes: Unique composite on (PageId, PermissionId)

Extensions

  • ServiceCollectionExtensions: Provides AddAuthorizationPageEntityFrameworkCore() extension method for registering EF Core services (currently a placeholder for future enhancements)

Database Schema

The configurations define the following database schema:

PageGroups
├── Id (PK)
├── Code (unique, required)
├── Name (required)
├── Icon (optional)
├── CreatedAt
└── UpdatedAt

Pages
├── Id (PK)
├── ParentId (FK to Pages.Id, nullable)
├── PageGroupId (FK to PageGroups.Id, nullable)
├── Code (unique, required)
├── Name (required)
├── Path (indexed, required)
├── CreatedAt
└── UpdatedAt

PagePermissions
├── Id (PK)
├── PageId (FK to Pages.Id, required)
├── PermissionId (required)
├── CreatedAt
└── UpdatedAt
├── Unique: (PageId, PermissionId)

Dependencies

  • MasLazu.AspNet.Framework.EfCore: Provides BaseDbContext and other EF Core utilities
  • MasLazu.AspNet.Authorization.Page.Domain: References the domain entities being configured

Target Framework

  • .NET 9.0
  • Nullable reference types enabled
  • Implicit usings enabled

Usage

To use this EF Core integration in an application:

  1. Configure the database context in your application's service registration:
builder.Services.AddDbContext<AuthorizationPageDbContext>(options =>
    options.UseSqlServer(connectionString)); // or other provider
  1. Apply migrations or ensure database schema matches the configurations.

  2. Inject AuthorizationPageDbContext or use it through repository patterns for data access.

The context can be used directly or through the repository interfaces provided by the framework for data operations.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.1 191 9/25/2025