DRN.Framework.EntityFramework 0.6.0

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

  • Implements IDesignTimeDbContextFactory to enable migrations from dbContext defining projects.
  • Implements IDesignTimeServices to support multi context projects with default output directories in the context specific folder.
  • Uses HasDrnContextServiceCollectionModule attribute for automatic registration with AddServicesWithAttributes service collection extension method.
  • Uses context name (typeof(TContext).Name) as connection string key by convention.
  • Automatically applies IEntityTypeConfiguration implementations from the assembly whose namespace contains the derived context's namespace.
  • Automatically marks Entities derived from DRN.Framework.SharedKernel.Domain.Entity as created, modified or deleted.
  • Enables DRN.Framework.Testing to create easy and effective integration tests with conventions and automatic registrations.
    • Application modules can be registered without any modification to TestContext
    • TestContext's ContainerContext
      • creates a postgresql container then scans TestContext's service collection for inherited DrnContexts.
      • Adds a connection strings to TestContext's configuration for each DrnContext according to convention.
    • TestContext acts as a ServiceProvider and when a service is requested it can build it from service collection with all dependencies.
namespace DRN.Framework.EntityFramework.Context;

[HasDrnContextServiceCollectionModule]
public abstract class DrnContext<TContext> : DbContext, IDesignTimeDbContextFactory<TContext>, IDesignTimeServices where TContext : DbContext, new()
{ 
...

public class HasDrnContextServiceCollectionModuleAttribute : HasServiceCollectionModuleAttribute
{
    static HasDrnContextServiceCollectionModuleAttribute()
    {
        ModuleMethodInfo = typeof(ServiceCollectionExtensions).GetMethod(nameof(ServiceCollectionExtensions.AddDbContextsWithConventions))!;
    }
}

Example Usage

namespace Sample.Infra;

public static class InfraModule
{
    public static IServiceCollection AddSampleInfraServices(this IServiceCollection sc)
    {
        sc.AddServicesWithAttributes();

        return sc;
    }
}

public class QAContext : DrnContext<QAContext>
{
    public QAContext(DbContextOptions<QAContext> options) : base(options)
    {
    }

    public QAContext() : base(null)
    {
    }

    public DbSet<User> Users { get; set; }
    public DbSet<Question> Questions { get; set; }
    public DbSet<Answer> Answers { get; set; }
    public DbSet<QuestionComment> Comments { get; set; }
    public DbSet<Category> Categories { get; set; }
    public DbSet<Tag> Tags { get; set; }
}

Development Environment Configurations

Following configuration options added to minimize development environment creation efforts:

  • 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
      • default is postgresql
    • DrnContext_DevPort
      • default is 5432
    • DrnContext_DevUsername
      • default is postgres
    • DrnContext_DevDatabase
      • default is drnDb

postgres-password and DrnContext_AutoMigrateDevEnvironment should be enough to start a hosted service that has DrnContext dependencies.

For instance:

  • When a Postgresql helm chart is used for dev environment and it creates a password secret automatically,
  • Then only defining a volume mount should be enough for database configuration.

Global Usings

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

Semper Progredi: Always Progressive

Commit Info

Author: Duran Serkan KILIÇ
Date: 2024-11-10 19:48:40 +0300
Hash: fe1e1c0bfc19e4c8b4586b78a0f81eca604bba1b

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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 (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-01-26 21:12:39 +0300 Hash: 858b6f431aa962dcd742ffa77fa3a94322c3754e

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0-preview059 39 1/26/2026
0.7.0-preview058 80 1/25/2026
0.7.0-preview057 80 1/25/2026
0.7.0-preview056 55 1/10/2026
0.7.0-preview055 234 12/16/2025
0.7.0-preview054 141 12/13/2025
0.7.0-preview053 93 12/12/2025
0.7.0-preview052 401 12/9/2025
0.7.0-preview051 265 12/7/2025
0.7.0-preview050 180 12/7/2025
0.7.0-preview049 151 11/26/2025
0.7.0-preview048 156 11/24/2025
0.7.0-preview047 147 11/7/2025
0.7.0-preview046 202 11/6/2025
0.7.0-preview045 200 11/3/2025
0.7.0-preview044 213 11/2/2025
0.7.0-preview043 135 11/1/2025
0.7.0-preview042 206 10/29/2025
0.7.0-preview041 123 10/25/2025
0.7.0-preview040 176 10/12/2025
0.7.0-preview039 132 10/11/2025
0.7.0-preview038 194 10/8/2025
0.7.0-preview037 197 9/28/2025
0.7.0-preview036 221 9/22/2025
0.7.0-preview035 205 8/31/2025
0.7.0-preview034 222 8/31/2025
0.7.0-preview033 241 8/28/2025
0.7.0-preview032 228 8/27/2025
0.7.0-preview031 217 8/10/2025
0.7.0-preview030 94 8/1/2025
0.7.0-preview029 122 8/1/2025
0.7.0-preview028 114 8/1/2025
0.7.0-preview027 150 7/31/2025
0.7.0-preview026 144 7/29/2025
0.7.0-preview025 160 7/27/2025
0.7.0-preview024 136 7/11/2025
0.7.0-preview023 135 7/11/2025
0.7.0-preview022 203 6/29/2025
0.7.0-preview021 203 6/23/2025
0.7.0-preview020 155 5/31/2025
0.7.0-preview019 245 3/23/2025
0.7.0-preview018 180 3/2/2025
0.7.0-preview017 170 2/23/2025
0.7.0-preview016 188 2/22/2025
0.7.0-preview015 155 2/21/2025
0.7.0-preview014 163 2/20/2025
0.7.0-preview013 181 2/9/2025
0.7.0-preview012 156 2/8/2025
0.7.0-preview011 164 2/2/2025
0.7.0-preview010 159 1/20/2025
0.7.0-preview009 169 1/19/2025
0.7.0-preview008 132 1/16/2025
0.7.0-preview007 173 12/29/2024
0.7.0-preview006 155 12/23/2024
0.7.0-preview005 159 11/27/2024
0.7.0-preview004 169 11/23/2024
0.7.0-preview003 160 11/20/2024
0.7.0-preview002 171 11/17/2024
0.7.0-preview001 184 11/14/2024
0.6.0 214 11/10/2024
0.6.0-preview002 162 11/10/2024
0.6.0-preview001 182 11/10/2024
0.5.1-preview002 171 9/30/2024
0.5.1-preview001 161 9/22/2024
0.5.0 231 8/30/2024
0.5.0-preview011 158 8/30/2024
0.5.0-preview010 179 8/25/2024
0.5.0-preview009 179 8/8/2024
0.5.0-preview008 173 8/7/2024
0.5.0-preview007 152 8/2/2024
0.5.0-preview006 142 7/30/2024
0.5.0-preview005 172 7/27/2024
0.5.0-preview004 183 7/15/2024
0.5.0-preview003 194 6/6/2024
0.5.0-preview002 171 6/5/2024
0.5.0-preview001 180 6/4/2024
0.4.0 180 5/19/2024
0.4.0-preview006 178 5/19/2024
0.4.0-preview005 204 5/12/2024
0.4.0-preview004 191 5/12/2024
0.4.0-preview003 173 5/11/2024
0.4.0-preview002 185 5/8/2024
0.4.0-preview001 207 5/5/2024
0.3.1-preview001 155 4/26/2024
0.3.0 212 4/23/2024
0.3.0-preview002 181 4/23/2024
0.3.0-preview001 180 4/23/2024
0.2.2-preview010 199 4/11/2024
0.2.2-preview009 169 3/18/2024
0.2.2-preview008 168 3/18/2024
0.2.2-preview007 176 3/16/2024
0.2.2-preview006 153 3/11/2024
0.2.2-preview005 180 3/10/2024
0.2.2-preview004 186 3/10/2024
0.2.2-preview003 255 1/22/2024
0.2.2-preview002 174 1/18/2024
0.2.2-preview001 202 1/14/2024
0.2.1 294 1/7/2024
0.2.0 193 12/31/2023
0.2.0-preview009 162 12/31/2023
0.2.0-preview008 135 12/30/2023
0.2.0-preview007 146 12/28/2023
0.2.0-preview006 157 12/27/2023
0.2.0-preview005 136 12/25/2023
0.2.0-preview004 144 12/23/2023
0.2.0-preview003 140 12/20/2023
0.2.0-preview002 148 12/19/2023

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 Progredi: Always Progressive**  
 
## Commit Info  
Author: Duran Serkan KILIÇ  
Date: 2024-11-10 19:48:40 +0300  
Hash: fe1e1c0bfc19e4c8b4586b78a0f81eca604bba1b