Nera.Lib.Database 1.0.0

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

Nera.Lib.Database

A comprehensive database access layer library for Nera applications, built on Entity Framework Core with advanced patterns and features.

Features

Repository Pattern - Generic and type-safe repository implementations
Specification Pattern - Composable and reusable query logic
Complex ThenInclude Support - Multi-level navigation property loading
Advanced Pagination - Efficient pagination with configurable sorting and filtering
Unit of Work - Transaction management and consistency
Domain Events - Event-driven architecture support
Audit Trail - Automatic tracking of entity changes
Soft Delete - Built-in soft deletion support
Multi-tenancy - Tenant isolation and security

Quick Start

1. Installation

dotnet add package Nera.Lib.Database

2. Basic Usage

// Simple entity retrieval
var users = await userRepository.ListAsync(
    SpecificationExtensions.CreateSpec<User>()
        .NotDeleted()
        .Search("john", "Name", "Email")
        .OrderByNewest()
        .AsNoTracking()
        .Build()
);

// Complex queries with includes
var user = await userRepository.FirstOrDefaultAsync(
    SpecificationExtensions.CreateSpec<User>()
        .ById(userId)
        .WithComplexIncludes(includes => includes
            .Include("Profile.Avatar")
            .Include("Department.Manager.Profile")
            .Include("UserRoles.Role.Permissions"))
        .AsNoTracking()
        .Build()
);

// Pagination
var pagedUsers = await userRepository.GetPagedResultWithSpecificationAsync(
    SpecificationExtensions.CreateSpec<User>()
        .NotDeleted()
        .Search("active", "Name", "Status")
        .OrderByNewest()
        .Build(),
    pageNumber: 1,
    pageSize: 20
);

Documentation

Key Components

Repository Pattern

  • BaseRepository<TEntity, TKey> - Generic repository base class
  • IRepository<TEntity, TKey> - Repository interface
  • Built-in CRUD operations with specifications support

Specification Pattern

  • BaseSpecification<T> - Base specification class
  • SpecificationExtensions - Fluent API for building specifications
  • ComplexIncludeSpecification - Advanced ThenInclude support
  • Pre-built specifications for common scenarios

Advanced Features

  • Complex ThenInclude: Handle multi-level navigation properties
  • Smart Pagination: Efficient counting and data retrieval
  • Search & Filtering: Configurable text search across multiple fields
  • Sorting: Dynamic sorting with field validation
  • Performance: Built-in AsNoTracking and query optimization

Architecture

Nera.Lib.Database/
├── Entities/              # Base entity classes
├── Repositories/          # Repository interfaces and implementations
├── Specifications/        # Specification pattern implementation
├── Persistence/           # Entity Framework Core integration
├── UnitOfWork/           # Unit of Work pattern
├── Events/               # Domain events
├── Aggregates/           # Domain aggregates
└── Examples/             # Usage examples

Requirements

  • .NET 9.0 or later
  • Entity Framework Core 9.0+
  • Nera.Lib.Core 1.0.5+

License

MIT License - see LICENSE file for details.

Contributing

Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.

Support

For support and questions:

  • 📧 Email: support@nextera-systems.com
  • 📝 Issues: GitHub Issues
  • 📖 Documentation: Wiki
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 97 8/3/2025