DRN.Framework.EntityFramework 0.7.0-preview059

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-preview059
                    
NuGet\Install-Package DRN.Framework.EntityFramework -Version 0.7.0-preview059
                    
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-preview059" />
                    
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-preview059" />
                    
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-preview059
                    
#r "nuget: DRN.Framework.EntityFramework, 0.7.0-preview059"
                    
#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-preview059
                    
#: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-preview059&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DRN.Framework.EntityFramework&version=0.7.0-preview059&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

Convention-based Entity Framework Core integration with automatic configuration, migrations, and domain event support.

TL;DR

  • Zero-Config DbContext - DrnContext<T> auto-registers, discovers configurations, and manages migrations
  • Source Known IDs - Internal long for DB performance, external Guid for API security
  • Auto-Tracking - Automatic CreatedAt/ModifiedAt timestamps and domain events
  • Prototype Mode - Auto-recreate database on model changes during development
  • Repository Base - SourceKnownRepository<TContext, TEntity> with pagination and validation

Table of Contents


QuickStart: Beginner

Define a DbContext and entity with automatic ID generation:

// 1. Define your entity with EntityType attribute
[EntityType(1)] // Unique byte per entity type
public class User : SourceKnownEntity
{
    public string Username { get; set; } = "";
}

// 2. Create your context inheriting from DrnContext
[DrnContextServiceRegistration]
[DrnContextDefaults]
[DrnContextPerformanceDefaults]
public class AppContext : DrnContext<AppContext>
{
    public AppContext(DbContextOptions<AppContext> options) : base(options) { }
    public AppContext() : base(null) { } // Required for migrations

    public DbSet<User> Users { get; set; }
}

// 3. Use in your service - IDs are auto-generated
public class UserService(AppContext context)
{
    public async Task CreateUserAsync(string username)
    {
        context.Users.Add(new User { Username = username }); // ID auto-generated
        await context.SaveChangesAsync();
    }
}

QuickStart: Advanced

Complete repository pattern with pagination and filtering:

// Repository with custom query methods
public interface IUserRepository : ISourceKnownRepository<User> 
{
    Task<User[]> GetActiveUsersAsync();
}

[Scoped<IUserRepository>]
public class UserRepository(AppContext context, IEntityUtils utils) 
    : SourceKnownRepository<AppContext, User>(context, utils), IUserRepository
{
    public async Task<User[]> GetActiveUsersAsync()
    {
        // EntitiesWithAppliedSettings() applies AsNoTracking, Filters, etc.
        return await EntitiesWithAppliedSettings()
            .Where(u => u.IsActive)
            .ToArrayAsync();
    }
}

// Controller with pagination
[ApiController, Route("api/users")]
public class UserController(IUserRepository repository) : ControllerBase
{
    [HttpGet]
    public async Task<PaginationResultModel<UserDto>> GetAsync([FromQuery] PaginationRequest request)
    {
        var result = await repository.PaginateAsync(request);
        return result.ToModel(u => new UserDto { Id = u.EntityId, Username = u.Username });
    }
    
    [HttpGet("{id:guid}")]
    public async Task<UserDto> GetByIdAsync(Guid id)
    {
        var user = await repository.GetAsync(id); // Validates ID automatically
        return new UserDto { Id = user.EntityId, Username = user.Username };
    }
}

Identity System

The framework uses a Source Known identifier system that balances database performance (long IDs) with external security (GUIDs) and type safety.

SourceKnownId

The internal structure representing identity components:

public readonly record struct SourceKnownId(
    long Id,                  // Internal DB ID (primary key)
    DateTimeOffset CreatedAt, // Timestamp of generation
    uint InstanceId,          // Generator instance ID
    byte AppId,               // Application ID
    byte AppInstanceId        // Application Instance ID
);

SourceKnownEntityId

The public-facing identifier wrapper used in contracts and domain logic:

public readonly record struct SourceKnownEntityId(
    SourceKnownId Source,   // Decoded internal components
    Guid EntityId,          // Opaque external GUID
    byte EntityType,        // Entity type discriminator
    bool Valid              // Structural validity flag
);

External vs Internal IDs

External Identity Rule: Always use Guid EntityId (mapped as Id in DTOs) for all public-facing contracts, API route parameters, and external lookups. The internal long Id must never be exposed outside the infrastructure/domain boundaries.

Why Two IDs?

  • Performance: long Id provides fast database indexing and joins
  • Security: Guid EntityId prevents enumeration attacks and ID guessing
  • Type Safety: EntityType byte ensures IDs are validated against the correct entity type

DrnContext

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

Required Attributes

Every DrnContext must be decorated with three attributes:

[DrnContextServiceRegistration, DrnContextDefaults, DrnContextPerformanceDefaults]
public abstract class DrnContext<TContext> : DbContext, IDrnContext<TContext> 
    where TContext : DrnContext<TContext>, new()
{
    // ...
}
Attribute Purpose
DrnContextServiceRegistration Auto-registration, startup validation, migration management
DrnContextDefaults Npgsql defaults, JSON configuration, logging setup
DrnContextPerformanceDefaults Connection pooling, multiplexing, command timeouts

Features

  • Zero-Config Registration: Uses [DrnContextServiceRegistration] for automatic DI registration, including IDesignTimeDbContextFactory support for migrations.
  • Convention-Based Configuration:
    • Context name defines the connection string key (e.g., QAContextConnectionStrings:QAContext).
    • Automatically applies IEntityTypeConfiguration from the context's assembly and namespace.
    • Schema naming derived from context name in snake_case.
  • 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.

Entity ID Generation

Entities inheriting from SourceKnownEntity have their IDs automatically generated when Id = 0:

  • Uses SourceKnownIdValueGenerator configured via HasValueGenerator<SourceKnownIdValueGenerator>().
  • Calls ISourceKnownIdUtils.Next<TEntity>() to generate collision-free long IDs.
  • Requirement: Every entity must have a unique [EntityType(n)] attribute.
  • Note: EntityId (Guid) and EntityIdSource are computed properties, ignored by EF Core.
[EntityType(1)]
public class User : SourceKnownEntity
{
    // Id is automatically generated on Add
    public string Username { get; set; }
}

Startup Validation

[DrnContextServiceRegistration] performs critical validations at startup:

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

Example

[DrnContextServiceRegistration]
[DrnContextDefaults]
[DrnContextPerformanceDefaults]
public class QAContext : DrnContext<QAContext>
{
    public QAContext(DbContextOptions<QAContext> options) : base(options) { }
    public QAContext() : base(null) { }  // Required for migrations

    public DbSet<User> Users { get; set; }
    public DbSet<Question> Questions { get; set; }
    public DbSet<Answer> Answers { get; set; }
}

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.

IEntityUtils

Repositories require IEntityUtils for core domain operations:

public class UserRepository(QAContext context, IEntityUtils utils) 
    : SourceKnownRepository<QAContext, User>(context, utils), IUserRepository
{
    // Custom query methods...
}

IEntityUtils provides:

  • Id: Identity generation and validation utilities
  • EntityId: GUID ↔ SourceKnownEntityId conversion
  • Cancellation: Token management and merging
  • Pagination: Pagination logic helpers
  • DateTime: Time-aware operations
  • ScopedLog: Integrated performance logging

RepositorySettings

Configure repository behavior via the Settings property:

public class RepositorySettings<TEntity>
{
    public bool AsNoTracking { get; set; }           // Disable change tracking
    public bool IgnoreAutoIncludes { get; set; }     // Prevent auto-loading navigations
    public IReadOnlyDictionary<string, Expression<Func<TEntity, bool>>> Filters { get; }
}

Configuration Examples:

// Read-only queries (performance optimization)
repository.Settings.AsNoTracking = true;
repository.Settings.IgnoreAutoIncludes = true;

// Tenant filtering (applied to all queries)
repository.Settings.AddFilter("TenantId", 
    entity => entity.TenantId == currentTenantId);

// Soft delete filter
repository.Settings.AddFilter("NotDeleted", 
    entity => entity.DeletedAt == null);

// Remove a filter
repository.Settings.RemoveFilter("TenantId");

// Clear all filters
repository.Settings.ClearFilters();

Pagination

Efficient cursor-based pagination using PaginateAsync:

// Basic pagination
var request = PaginationRequest.DefaultWith(pageSize: 20);
var result = await repository.PaginateAsync(request);

// Access results
foreach (var user in result.Items)
{
    Console.WriteLine(user.Username);
}

// Navigate to next page
if (result.Info.HasNext)
{
    var nextRequest = result.Info.RequestNextPage();
    var nextPage = await repository.PaginateAsync(nextRequest);
}

// Navigate to previous page
if (result.Info.HasPrevious)
{
    var prevRequest = result.Info.RequestPreviousPage();
    var prevPage = await repository.PaginateAsync(prevRequest);
}

// Filter by creation date
var filter = EntityCreatedFilter.After(DateTime.UtcNow.AddDays(-7));
var recentUsers = await repository.PaginateAsync(request, filter);

// Map to DTOs while preserving pagination
var dtoResult = result.ToModel(user => new UserDto 
{ 
    Id = user.EntityId, 
    Username = user.Username 
});

Query Composition

For custom queries, use protected methods that respect repository settings:

public class UserRepository(QAContext context, IEntityUtils utils) 
    : SourceKnownRepository<QAContext, User>(context, utils)
{
    public async Task<User[]> GetActiveUsersAsync()
    {
        // EntitiesWithAppliedSettings() applies AsNoTracking, IgnoreAutoIncludes, and Filters
        var query = EntitiesWithAppliedSettings()
            .Where(u => u.IsActive);
            
        return await query.ToArrayAsync();
    }
    
    public async Task<PaginationResultModel<User>> GetUsersByRoleAsync(
        string role, 
        PaginationRequest request)
    {
        var query = EntitiesWithAppliedSettings()
            .Where(u => u.Role == role);
            
        return await PaginateAsync(query, request);
    }
}

Validation

The repository validates SourceKnownEntityId entity types before query execution:

// This will throw ValidationException if the ID's EntityType doesn't match User
var userId = repository.GetEntityId(someGuid, validate: true);
var user = await repository.GetAsync(userId);

// Validate multiple IDs
var userIds = repository.GetEntityIds(guidList, validate: true);
var users = await repository.GetAsync(userIds);

Attributes & Configuration

DrnContextServiceRegistrationAttribute

Enables automatic registration and lifecycle management for your DbContext.

Features:

  • Auto-registers context with DI container
  • Validates entity type uniqueness at startup
  • Applies pending migrations if configured
  • Runs seed data after migrations

DrnContextDefaultsAttribute

Provides framework defaults for Npgsql and EF Core:

Npgsql Defaults:

  • Query splitting behavior: SplitQuery
  • Migrations assembly: Context's assembly
  • Migrations history table: {context_name}_history in __entity_migrations schema
  • PostgreSQL version: 18.1

Data Source Defaults:

  • Parameter logging: Disabled
  • JSON options: Framework's JsonConventions.DefaultOptions
  • Application name: {AppName}_{ContextName}

DbContext Defaults:

  • Snake case naming convention
  • Warning-level logging to IScopedLog
  • Test environment warning suppression

DrnContextPerformanceDefaultsAttribute

Provides production-ready performance settings for Npgsql:

[DrnContextPerformanceDefaults(
    multiplexing: true,
    maxAutoPrepare: 200,
    autoPrepareMinUsages: 5,
    minPoolSize: 1,
    maxPoolSize: 15,
    readBufferSize: 8192,
    writeBufferSize: 8192,
    commandTimeout: 30
)]
public class MyContext : DrnContext<MyContext> { }

NpgsqlDbContextOptionsAttribute

Base attribute for custom database configuration. Override methods to customize behavior:

public class MyContextOptions : NpgsqlDbContextOptionsAttribute
{
    public override void ConfigureNpgsqlOptions<TContext>(
        NpgsqlDbContextOptionsBuilder builder, 
        IServiceProvider? serviceProvider)
    {
        // Configure Npgsql-specific options
        builder.CommandTimeout(60);
        builder.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
    }

    public override void ConfigureNpgsqlDataSource<TContext>(
        NpgsqlDataSourceBuilder builder, 
        IServiceProvider serviceProvider)
    {
        // Configure NpgsqlDataSource
        builder.EnableDynamicJson();
        builder.EnableParameterLogging();
    }

    public override void ConfigureDbContextOptions<TContext>(
        DbContextOptionsBuilder builder, 
        IServiceProvider? serviceProvider)
    {
        base.ConfigureDbContextOptions<TContext>(builder, serviceProvider);
        
        // Configure general DbContext options
        builder.EnableSensitiveDataLogging();
        builder.EnableDetailedErrors();
    }

    public override async Task SeedAsync(
        IServiceProvider serviceProvider, 
        IAppSettings appSettings)
    {
        // Seed data after migrations
        var context = serviceProvider.GetRequiredService<TContext>();
        if (!await context.Users.AnyAsync())
        {
            context.Users.Add(new User { Username = "admin" });
            await context.SaveChangesAsync();
        }
    }
}

Usage:

[DrnContextServiceRegistration]
[DrnContextDefaults]
[MyContextOptions(UsePrototypeMode = true)]
public class MyDbContext : DrnContext<MyDbContext> { }

NpgsqlPerformanceSettingsAttribute

Abstract base for declarative performance tuning. Create custom attributes by inheriting:

public class HighThroughputSettings : NpgsqlPerformanceSettingsAttribute
{
    public HighThroughputSettings() : base(
        multiplexing: true,
        maxAutoPrepare: 500,
        autoPrepareMinUsages: 3,
        minPoolSize: 10,
        maxPoolSize: 100,
        readBufferSize: 16384,
        writeBufferSize: 16384,
        commandTimeout: 60)
    {
    }
}

Prototype Mode

Prototype Mode enables rapid development by automatically recreating the database when model changes are detected.

What It Does

When prototype mode is active and 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.

How to Enable

Prototype mode requires all three of the following conditions:

  1. Attribute Configuration: Set UsePrototypeMode = true on your NpgsqlDbContextOptionsAttribute
[DrnContextServiceRegistration]
[DrnContextDefaults]
[MyProjectPrototypeSettings(UsePrototypeMode = true)]
public class MyDbContext : DrnContext<MyDbContext> { }
  1. Development Settings: Configure in appsettings.Development.json
{
  "DrnDevelopmentSettings": {
    "LaunchExternalDependencies": true,  // Uses testcontainer instead of connection string
    "AutoMigrate": true,                 // Required for schema initialization
    "Prototype": true                    // Enables database recreation on model changes
  }
}
  1. Development Environment: Must be running in Development environment

When Database Recreates

The database is recreated only when:

  • Pending model changes exist (no migration created yet)
  • UsePrototypeMode = true on the attribute
  • DrnDevelopmentSettings.Prototype = true in configuration
  • DrnDevelopmentSettings.LaunchExternalDependencies = true (uses testcontainer)

If DrnDevelopmentSettings.Prototype is false, the database is never recreated—even if UsePrototypeMode is enabled and model changes are detected. This gives you control over when prototype behavior is active.

Prototype Mode with Existing Migrations

By default, prototype mode is disabled once migrations exist. To override this behavior:

[MyProjectPrototypeSettings(
    UsePrototypeMode = true,
    UsePrototypeModeWhenMigrationExists = true
)]
public class MyDbContext : DrnContext<MyDbContext> { }

Development Environment

The framework reduces dev-setup friction by inferring configurations.

Auto-Connection String

If postgres-password is set in configuration and environment is Development, a connection string is generated automatically:

{
  "Environment": "Development",
  "postgres-password": "dev-password"
}

Auto-generates: Host=postgresql;Port=5432;Database=drnDb;Username=postgres;Password=dev-password

Environment Variables

Customize the auto-generated connection string:

Variable Default Purpose
DrnContext_DevHost postgresql Database host
DrnContext_DevPort 5432 Database port
DrnContext_DevUsername postgres Database username
DrnContext_DevDatabase drnDb Database name
DrnContext_AutoMigrateDevEnvironment false Auto-apply migrations at startup

Local Development Workflow

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

Docker Compose Example:

services:
  postgres:
    image: postgres:18
    environment:
      POSTGRES_PASSWORD: dev-password
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data

volumes:
  postgres-data:

appsettings.Development.json:

{
  "Environment": "Development",
  "postgres-password": "dev-password",
  "DrnContext_AutoMigrateDevEnvironment": "true"
}

With this setup, your application will:

  1. Auto-generate connection string
  2. Apply pending migrations on startup
  3. Be ready for development

Entity Configuration

The framework supports both attribute-based and Fluent API configuration.

Attribute-Based Configuration (Preferred)

Use attributes for simple, standard configurations:

[EntityType(1)]
[Table("users")]
[Index(nameof(Username), IsUnique = true)]
public class User : SourceKnownEntity
{
    [MaxLength(100)]
    [Required]
    public string Username { get; set; }
    
    [MaxLength(255)]
    [EmailAddress]
    public string Email { get; set; }
    
    public bool IsActive { get; set; } = true;
}

Fluent API Configuration (Complex Cases)

Use IEntityTypeConfiguration for complex relationships and conditional mapping:

public class UserConfiguration : IEntityTypeConfiguration<User>
{
    public void Configure(EntityTypeBuilder<User> builder)
    {
        // Complex relationships
        builder.HasMany(u => u.Posts)
               .WithOne(p => p.Author)
               .HasForeignKey(p => p.AuthorId)
               .OnDelete(DeleteBehavior.Cascade);
        
        // Composite indexes
        builder.HasIndex(u => new { u.TenantId, u.Username })
               .IsUnique();
        
        // Owned entities
        builder.OwnsOne(u => u.Address, address =>
        {
            address.Property(a => a.Street).HasMaxLength(200);
            address.Property(a => a.City).HasMaxLength(100);
        });
    }
}

Design Preference: Prefer attribute-based design over Fluent API when available. Use Fluent API only for complex definitions that cannot be elegantly expressed with attributes (e.g., composite keys, complex many-to-many relationships, or conditional mapping).

Auto-Discovery

Configurations are automatically discovered and applied if they:

  • Reside in the same assembly as the context
  • Share the context's namespace (or a sub-namespace)
Sample.Infra/
├── QAContext.cs                    # Namespace: Sample.Infra
├── Configurations/
│   ├── UserConfiguration.cs        # Namespace: Sample.Infra.Configurations ✓
│   └── QuestionConfiguration.cs    # Namespace: Sample.Infra.Configurations ✓

JSON Models

Entities implementing IEntityWithModel<TModel> have their Model property automatically mapped to a jsonb column:

public class Question : AggregateRoot<QuestionModel>
{
    // Model property is automatically configured as jsonb
}

public class QuestionModel
{
    public string Title { get; set; }
    public string Body { get; set; }
    public List<string> Tags { get; set; }
}

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-26 21:12:39 +0300
Hash: 858b6f431aa962dcd742ffa77fa3a94322c3754e

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-08 23:03:03 +0300 Hash: a79b5357114f874f8a2956315f27911d316b9bac

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0 88 3/8/2026
0.7.0-preview067 83 3/7/2026
0.7.0-preview066 92 2/28/2026
0.7.0-preview065 97 2/25/2026
0.7.0-preview064 97 2/22/2026
0.7.0-preview063 95 2/21/2026
0.7.0-preview062 90 2/11/2026
0.7.0-preview061 116 2/7/2026
0.7.0-preview060 99 1/28/2026
0.7.0-preview059 102 1/26/2026
0.7.0-preview058 102 1/25/2026
0.7.0-preview057 99 1/25/2026
0.7.0-preview056 68 1/10/2026
0.7.0-preview055 243 12/16/2025
0.7.0-preview054 157 12/13/2025
0.7.0-preview053 106 12/12/2025
0.7.0-preview052 416 12/9/2025
0.7.0-preview051 280 12/7/2025
0.7.0-preview050 197 12/7/2025
0.7.0-preview049 163 11/26/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-26 21:12:39 +0300  
Hash: 858b6f431aa962dcd742ffa77fa3a94322c3754e