DRN.Framework.EntityFramework 0.7.0-preview057

Prefix Reserved
This is a prerelease version of DRN.Framework.EntityFramework.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DRN.Framework.EntityFramework --version 0.7.0-preview057
                    
NuGet\Install-Package DRN.Framework.EntityFramework -Version 0.7.0-preview057
                    
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="DRN.Framework.EntityFramework" Version="0.7.0-preview057" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DRN.Framework.EntityFramework" Version="0.7.0-preview057" />
                    
Directory.Packages.props
<PackageReference Include="DRN.Framework.EntityFramework" />
                    
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 DRN.Framework.EntityFramework --version 0.7.0-preview057
                    
#r "nuget: DRN.Framework.EntityFramework, 0.7.0-preview057"
                    
#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 DRN.Framework.EntityFramework@0.7.0-preview057
                    
#: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=DRN.Framework.EntityFramework&version=0.7.0-preview057&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DRN.Framework.EntityFramework&version=0.7.0-preview057&prerelease
                    
Install as a Cake Tool

master develop Quality Gate Status

Security Rating Maintainability Rating Reliability Rating Vulnerabilities Bugs Lines of Code Coverage

DRN.Framework.EntityFramework provides DrnContext with conventions to develop rapid and effective domain models.

DRNContext

DrnContext is the foundational DbContext implementation that integrates with the DRN Framework ecosystem.

  • Zero-Config Registration: Uses [DrnContextServiceRegistration] for automatic DI registration, including IDesignTimeDbContextFactory support for migrations.
  • Convention-Based Configuration:
    • Context name defines the connection string key.
    • Automatically applies IEntityTypeConfiguration from the assembly.
  • Audit Support: Automatically manages IDomainEvent dispatching and Tracking properties (CreatedAt, ModifiedAt) for SourceKnownEntity.
  • Integration Testing: Native support for DRN.Framework.Testing's ContainerContext for isolated Postgres container tests.
[DrnContextServiceRegistration, DrnContextDefaults, DrnContextPerformanceDefaults]
public abstract class DrnContext<TContext> : DbContext, IDrnContext<TContext> where TContext : DrnContext<TContext>, new()
{
    // ...
}

SourceKnownRepository

SourceKnownRepository<TContext, TEntity> is the EF Core implementation of SharedKernel.ISourceKnownRepository. It provides a production-ready data access layer with built-in performance and consistency checks.

  • RepositorySettings:
    • AsNoTracking: Globally enable/disable tracking for queries.
    • IgnoreAutoIncludes: prevent auto-loading of navigation properties for performance.
    • Filters: Apply global LINQ filters (e.g., Soft Delete, Tenancy) automatically to all queries.
  • Pagination: Efficient cursor-based pagination using PaginateAsync.
  • Validation: Validates SourceKnownEntityId entity types before query execution.
public class UserRepository(MyDbContext context, IEntityUtils utils) 
    : SourceKnownRepository<MyDbContext, User>(context, utils), IUserRepository
{
    // Custom query methods...
}

Attributes & Configuration

DrnContextServiceRegistrationAttribute

Decorate your DbContext with this to enable automatic registration and lifecycle management.

  • Startup Validation:
    • Scope Check: Validates that 50+ service scopes can be created rapidly (catches singleton/scoped mismatches early).
    • Entity Type Check: Scans all SourceKnownEntity types in the model to ensure they have unique [EntityType] attributes.
  • Auto-Migration & Seeding:
    • Detects pending migrations and applies them if configured (DrnContext_AutoMigrateDevEnvironment).
    • Runs SeedAsync implementations from registered NpgsqlDbContextOptionsAttributes after migration.

NpgsqlDbContextOptionsAttribute

Provides Npgsql-specific configuration and enables Prototype Mode.

  • Prototype Mode [NpgsqlDbContextOptions(UsePrototypeMode = true)]:
    • Designed for rapid development.
    • How it works: If the framework detects pending model changes (e.g., you added a property to an entity) but no corresponding migration exists yet, it will automatically drop and recreate the local development database.
    • Benefit: Eliminates the need to create "junk" migrations during the initial prototyping phase.
  • Configuration Hooks: Override ConfigureNpgsqlOptions or ConfigureDbContextOptions to customize the driver.
[DrnContextServiceRegistration]
[DrnContextDefaults]
[MyProjectPrototypeSettings(UsePrototypeMode = true)] // Custom attribute inheriting NpgsqlDbContextOptionsAttribute
public class MyDbContext : DrnContext<MyDbContext> { ... }

Development Environment Configurations

The framework reduces dev-setup friction by inferring configurations:

  • Auto-Connection String: If postgres-password is set and environment is Development, a connection string is generated automatically (defaulting to localhost:5432).
  • Environment Variables:
    • DrnContext_AutoMigrateDevEnvironment: Set true to apply migrations at startup.
    • DrnContext_DevHost, DrnContext_DevPort, DrnContext_DevDatabase: Customize the auto-generated connection details.

Just setting postgres-password and mounting a volume for your DB container is usually enough to get a full persistent dev environment running.

Global Usings

global using DRN.Framework.EntityFramework.Context;
global using Microsoft.EntityFrameworkCore;
global using DRN.Framework.Utils.DependencyInjection;

Semper Progressivus: Always Progressive

Commit Info

Author: Duran Serkan KILIÇ
Date: 2026-01-25 10:27:24 +0300
Hash: 7703f177a808c9188630ababed58c565601f380b

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on DRN.Framework.EntityFramework:

Package Downloads
DRN.Framework.Testing

DRN.Framework.Testing package encapsulates testing dependencies and provides practical, effective helpers such as resourceful data attributes and test context. This package enables a new encouraging testing technique called as DTT(Duran's Testing Technique). With DTT, any developer can write clean and hassle-free unit and integration tests without complexity. ## Commit Info Author: Duran Serkan KILIÇ Date: 2026-03-26 21:45:03 +0300 Hash: 30e1be57f4eb7a89ca3ee1b45ce745fee9428273

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.1 85 3/26/2026
0.9.0 79 3/25/2026
0.9.0-preview001 90 3/22/2026
0.8.0 104 3/14/2026
0.7.0 95 3/8/2026
0.7.0-preview067 89 3/7/2026
0.7.0-preview066 95 2/28/2026
0.7.0-preview065 101 2/25/2026
0.7.0-preview064 100 2/22/2026
0.7.0-preview063 98 2/21/2026
0.7.0-preview062 91 2/11/2026
0.7.0-preview061 117 2/7/2026
0.7.0-preview060 100 1/28/2026
0.7.0-preview059 104 1/26/2026
0.7.0-preview058 103 1/25/2026
0.7.0-preview057 100 1/25/2026
0.7.0-preview056 69 1/10/2026
0.7.0-preview055 244 12/16/2025
0.7.0-preview054 161 12/13/2025
0.7.0-preview053 111 12/12/2025
Loading failed

Not every version includes changes, features or bug fixes. This project can increment version to keep consistency with other DRN.Framework projects.

## Version 0.6.0

My family celebrates the enduring legacy of Mustafa Kemal Atatürk's enlightenment ideals. This release is dedicated to the memory of Mustafa Kemal Atatürk, founder of the Republic of Türkiye, and to his vision for a modern, enlightened, democratic nation. In his eternal rest, he continues to guide us through his ideals of freedom, progress, and national sovereignty.

## Version 0.5.0

My family celebrates the enduring legacy of Mustafa Kemal Atatürk's enlightenment ideals. This release is dedicated to August 30 Victory Day, a day that marks the decisive victory achieved by the Turkish people against imperialism during the Turkish War of Independence, leading to the establishment of the Republic of Türkiye.

### New Features

* DbContext attributes to make default configurations visible and easier to configure
 * NpgsqlPerformanceSettingsAttribute and its default implementation DrnContextPerformanceDefaultsAttribute added
 * NpgsqlDbContextOptionsAttribute and its default implementation DrnContextDefaultsAttribute added

## Version 0.4.0

My family celebrates the enduring legacy of Mustafa Kemal Atatürk's enlightenment ideals. This release is dedicated to 19 May Commemoration of Atatürk, Youth and Sports Day.

### Breaking Changes

* DrnContext and DrnContextIdentity MigrationsHistoryTable database schema changes as __entity_migrations
 * Each DbContext's history table is named according to following convention:
   * {contextName.ToSnakeCase()}_history
* DrnContext and DrnContextIdentity applies context name with snake case formatting as default schema name.

### New Features

* DrnContextIdentity to support ASP.NET Core Identity  with DrnContext features
 * DrnContextIdentity to inherits IdentityDbContext

### Bug Fixes

* Microsoft.EntityFrameworkCore.Tools PrivateAssets were preventing migration

## Version 0.3.0

My family celebrates the enduring legacy of Mustafa Kemal Atatürk's enlightenment ideals. This release is dedicated to 23 April National Sovereignty and Children's Day.

### New Features

* DrnContext development connection string will be auto generated when
   * Environment configuration key set as Development and,
   * postgres-password configuration key set and,
   * No other connection string is provided for the DbContexts.
* Following keys can set optionally according to DbContextConventions;
   * DrnContext_AutoMigrateDevEnvironment
       * When set true applies migrations automatically
   * DrnContext_DevHost
   * DrnContext_DevPort
   * DrnContext_DevUsername
       * default is postgres
   * DrnContext_DevDatabase
       * default is drnDb

## Version 0.2.0

### New Features

*  DrnContext
   * Implemented IDesignTimeDbContextFactory to enable migrations from dbContext defining projects.
   * Implemented IDesignTimeServices to support multi context projects with default output directory in the context specific folder.
   * Uses HasDrnContextServiceCollectionModule to automatic registration with AddServicesWithAttributes service collection extension method.
   * Uses context name (typeof(TContext).Name) as connection string key by convention.
   * Enables DRN.Framework.Testing to create easy and effective integration tests with conventions and automatic registrations.

---

**Semper Progressivus: Always Progressive**  
 
## Commit Info  
Author: Duran Serkan KILIÇ  
Date: 2026-01-25 10:27:24 +0300  
Hash: 7703f177a808c9188630ababed58c565601f380b