DRN.Framework.EntityFramework
0.2.2-preview005
Prefix Reserved
See the version list below for details.
dotnet add package DRN.Framework.EntityFramework --version 0.2.2-preview005
NuGet\Install-Package DRN.Framework.EntityFramework -Version 0.2.2-preview005
<PackageReference Include="DRN.Framework.EntityFramework" Version="0.2.2-preview005" />
<PackageVersion Include="DRN.Framework.EntityFramework" Version="0.2.2-preview005" />
<PackageReference Include="DRN.Framework.EntityFramework" />
paket add DRN.Framework.EntityFramework --version 0.2.2-preview005
#r "nuget: DRN.Framework.EntityFramework, 0.2.2-preview005"
#:package DRN.Framework.EntityFramework@0.2.2-preview005
#addin nuget:?package=DRN.Framework.EntityFramework&version=0.2.2-preview005&prerelease
#tool nuget:?package=DRN.Framework.EntityFramework&version=0.2.2-preview005&prerelease
DRN.Framework.EntityFramework provides DrnContext with conventions to develop rapid and effective domain models.
DRNContext
DrnContext has following unique features:
- Implements
IDesignTimeDbContextFactoryto enable migrations from dbContext defining projects. - Implements
IDesignTimeServicesto support multi context projects with default output directories in the context specific folder. - Uses
HasDrnContextServiceCollectionModuleattribute for automatic registration with AddServicesWithAttributes service collection extension method. - Uses context name (typeof(TContext).Name) as connection string key by convention.
- Automatically applies
IEntityTypeConfigurationimplementations from the assembly whose namespace contains the derived context's namespace. - Automatically marks Entities derived from
DRN.Framework.SharedKernel.Domain.Entityas created, modified or deleted. - Enables
DRN.Framework.Testingto create easy and effective integration tests with conventions and automatic registrations.- Application modules can be registered without any modification to
TestContext TestContext'sContainerContext- creates a
postgresql containerthen scans TestContext's service collection for inherited DrnContexts. - Adds a connection strings to TestContext's configuration for each
DrnContextaccording to convention.
- creates a
TestContextacts as a ServiceProvider and when a service is requested it can build it from service collection with all dependencies.
- Application modules can be registered without any modification to
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
Environmentconfiguration key set as Development and,DrnContext_DevPasswordconfiguration 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_DevHostDrnContext_DevPortDrnContext_DevUsername- default is postgres
DrnContext_DevDatabase- default is drnDb
DrnContext_DevPassword 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;
Commit Info
Author: Duran Serkan KILIÇ
Date: 2024-03-10 21:11:34 +0300
Hash: 758d3a3bbe39cc018d64f55d656dcd0f794ac917
| Product | Versions 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. |
-
net8.0
- DRN.Framework.Utils (>= 0.2.2-preview005)
- EFCore.NamingConventions (>= 8.0.3)
- Microsoft.EntityFrameworkCore.Tools (>= 8.0.2)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 8.0.2)
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-02-11 22:40:07 +0300 Hash: 1be6f0a97b8f2e47322fbfcbf623140d706f706b |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.0-preview062 | 26 | 2/11/2026 |
| 0.7.0-preview061 | 106 | 2/7/2026 |
| 0.7.0-preview060 | 90 | 1/28/2026 |
| 0.7.0-preview059 | 94 | 1/26/2026 |
| 0.7.0-preview058 | 93 | 1/25/2026 |
| 0.7.0-preview057 | 90 | 1/25/2026 |
| 0.7.0-preview056 | 59 | 1/10/2026 |
| 0.7.0-preview055 | 238 | 12/16/2025 |
| 0.7.0-preview054 | 149 | 12/13/2025 |
| 0.7.0-preview053 | 98 | 12/12/2025 |
| 0.7.0-preview052 | 405 | 12/9/2025 |
| 0.7.0-preview051 | 270 | 12/7/2025 |
| 0.7.0-preview050 | 186 | 12/7/2025 |
| 0.7.0-preview049 | 156 | 11/26/2025 |
| 0.7.0-preview048 | 163 | 11/24/2025 |
| 0.7.0-preview047 | 152 | 11/7/2025 |
| 0.7.0-preview046 | 208 | 11/6/2025 |
| 0.7.0-preview045 | 205 | 11/3/2025 |
| 0.6.0 | 219 | 11/10/2024 |
| 0.2.2-preview005 | 181 | 3/10/2024 |
Not every version includes changes, features or bug fixes. This project can increment version to keep consistency with other DRN.Framework projects.
## Version 0.2.2
### Breaking Changes
### New Features
* DrnContext development connection string will be auto generated when
* Environment configuration key set as Development and,
* DrnContext_DevPassword 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
### Bug Fixes
## Version 0.2.0
### Breaking Changes
### New Features
* DrnContext added
* 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.
### Bug Fixes
## Commit Info
Author: Duran Serkan KILIÇ
Date: 2024-03-10 21:11:34 +0300
Hash: 758d3a3bbe39cc018d64f55d656dcd0f794ac917