MasLazu.AspNet.Authorization.Core 1.0.0-preview.7

This is a prerelease version of MasLazu.AspNet.Authorization.Core.
dotnet add package MasLazu.AspNet.Authorization.Core --version 1.0.0-preview.7
                    
NuGet\Install-Package MasLazu.AspNet.Authorization.Core -Version 1.0.0-preview.7
                    
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.Core" Version="1.0.0-preview.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MasLazu.AspNet.Authorization.Core" Version="1.0.0-preview.7" />
                    
Directory.Packages.props
<PackageReference Include="MasLazu.AspNet.Authorization.Core" />
                    
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.Core --version 1.0.0-preview.7
                    
#r "nuget: MasLazu.AspNet.Authorization.Core, 1.0.0-preview.7"
                    
#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.Core@1.0.0-preview.7
                    
#: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.Core&version=1.0.0-preview.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MasLazu.AspNet.Authorization.Core&version=1.0.0-preview.7&prerelease
                    
Install as a Cake Tool

MasLazu.AspNet.Authorization.Core

This project contains the core implementation of the MasLazu ASP.NET Authorization system. It provides concrete implementations of the service interfaces defined in the Abstraction layer, along with dependency injection registrations, validation rules, and utility classes.

Overview

The Core layer serves as the main implementation hub, bringing together the abstractions, domain entities, and framework components to provide a complete authorization system. It implements the business logic through service classes and handles cross-cutting concerns like validation and dependency injection.

Architecture

The project follows a modular architecture with clear separation of concerns:

Core Layer
├── Services/          # Business logic implementations
├── Extensions/        # Dependency injection registrations
├── Validators/        # Input validation rules
└── Utils/            # Property mapping utilities

Services

The project implements all service interfaces from the Abstraction layer using the framework's CrudService<T> base class:

Implemented Services

  1. ActionService - Implements IActionService
  2. PermissionService - Implements IPermissionService
  3. PermissionTypeService - Implements IPermissionTypeService
  4. ResourceService - Implements IResourceService
  5. ResourceActionService - Implements IResourceActionService

Each service inherits from CrudService<TEntity, TDto, TCreateRequest, TUpdateRequest> and provides full CRUD operations with:

  • Repository pattern for data access
  • Unit of work for transaction management
  • Validation integration
  • Property mapping for sorting and filtering

Extensions

The Extensions folder contains dependency injection setup classes:

AuthorizationCoreApplicationExtension

Main extension method that registers all components:

services.AddAuthorizationCoreApplication();

AuthorizationCoreApplicationServiceExtension

Registers all service implementations in the DI container.

AuthorizationCoreApplicationUtilExtension

Registers property maps and expression builders for dynamic querying and sorting.

AuthorizationCoreApplicationValidatorExtension

Registers all FluentValidation validators for request validation.

Validators

Comprehensive validation rules using FluentValidation:

Create Validators

  • CreateActionRequestValidator
  • CreatePermissionRequestValidator
  • CreatePermissionTypeRequestValidator
  • CreateResourceRequestValidator
  • CreateResourceActionRequestValidator

Update Validators

  • UpdateActionRequestValidator
  • UpdatePermissionRequestValidator
  • UpdatePermissionTypeRequestValidator
  • UpdateResourceRequestValidator
  • UpdateResourceActionRequestValidator

Validation Rules

Common validation patterns include:

  • Required fields (NotEmpty)
  • Maximum length constraints
  • Format validation where applicable

Utils (Property Maps)

Property mapping classes for dynamic sorting and filtering:

  • ActionEntityPropertyMap
  • PermissionEntityPropertyMap
  • PermissionTypeEntityPropertyMap
  • ResourceEntityPropertyMap
  • ResourceActionEntityPropertyMap

Each map implements IEntityPropertyMap<TEntity> and provides:

  • Case-insensitive property name mapping
  • Expression trees for LINQ queries
  • Support for common properties (id, code, name, timestamps)

Dependencies

This project depends on:

  • MasLazu.AspNet.Authorization.Core.Abstraction - Service interfaces and DTOs
  • MasLazu.AspNet.Authorization.Core.Domain - Domain entities
  • FluentValidation - Input validation framework
  • Microsoft.Extensions.DependencyInjection - DI container
  • MasLazu.AspNet.Framework.Application - Base service classes and interfaces

Usage

Basic Setup

var services = new ServiceCollection();

// Add the complete authorization system
services.AddAuthorizationCoreApplication();

// Additional setup (repositories, database context, etc.)
// ...

var serviceProvider = services.BuildServiceProvider();

Individual Component Registration

// Register only services
services.AddAuthorizationCoreApplicationServices();

// Register only validators
services.AddAuthorizationCoreApplicationValidators();

// Register only utilities
services.AddAuthorizationCoreApplicationUtils();

Service Usage

// Inject services
private readonly IActionService _actionService;

// Use CRUD operations
var actions = await _actionService.GetAllAsync();
var action = await _actionService.GetByIdAsync(id);
await _actionService.CreateAsync(request);
await _actionService.UpdateAsync(request);
await _actionService.DeleteAsync(id);

Integration

This Core project integrates with:

  • EF Core Layer: Provides data access implementations
  • Endpoint Layer: Exposes HTTP APIs
  • Application Layer: Orchestrates business operations

The Core layer acts as the central orchestrator, coordinating between the abstraction contracts and concrete implementations while providing a clean API for higher-level components.

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.7 155 10/9/2025
1.0.0-preview.6 126 10/9/2025
1.0.0-preview.5 127 10/9/2025
1.0.0-preview.1 157 9/20/2025