DRN.Framework.EntityFramework
0.2.2-preview001
Prefix Reserved
See the version list below for details.
dotnet add package DRN.Framework.EntityFramework --version 0.2.2-preview001
NuGet\Install-Package DRN.Framework.EntityFramework -Version 0.2.2-preview001
<PackageReference Include="DRN.Framework.EntityFramework" Version="0.2.2-preview001" />
paket add DRN.Framework.EntityFramework --version 0.2.2-preview001
#r "nuget: DRN.Framework.EntityFramework, 0.2.2-preview001"
// Install DRN.Framework.EntityFramework as a Cake Addin #addin nuget:?package=DRN.Framework.EntityFramework&version=0.2.2-preview001&prerelease // Install DRN.Framework.EntityFramework as a Cake Tool #tool nuget:?package=DRN.Framework.EntityFramework&version=0.2.2-preview001&prerelease
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
'sContainerContext
- 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.
- creates a
TestContext
acts 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; }
}
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-01-14 22:24:22 +0300
Hash: efdae18604a33651bb9a9196db3a3b3696b93def
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. |
-
net8.0
- DRN.Framework.Utils (>= 0.2.2-preview001)
- EFCore.NamingConventions (>= 8.0.2)
- Microsoft.EntityFrameworkCore.Tools (>= 8.0.1)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 8.0.0)
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: 2024-12-22 23:30:25 +0300 Hash: 25fb02068c9add44038c1806651e6aafe0ab0dad |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.7.0-preview006 | 24 | 12/23/2024 |
0.7.0-preview005 | 68 | 11/27/2024 |
0.7.0-preview004 | 81 | 11/23/2024 |
0.7.0-preview003 | 82 | 11/20/2024 |
0.7.0-preview002 | 74 | 11/17/2024 |
0.7.0-preview001 | 75 | 11/14/2024 |
0.6.0 | 102 | 11/10/2024 |
0.6.0-preview002 | 83 | 11/10/2024 |
0.6.0-preview001 | 83 | 11/10/2024 |
0.5.1-preview002 | 80 | 9/30/2024 |
0.5.1-preview001 | 83 | 9/22/2024 |
0.5.0 | 127 | 8/30/2024 |
0.5.0-preview011 | 88 | 8/30/2024 |
0.5.0-preview010 | 115 | 8/25/2024 |
0.5.0-preview009 | 106 | 8/8/2024 |
0.5.0-preview008 | 105 | 8/7/2024 |
0.5.0-preview007 | 70 | 8/2/2024 |
0.5.0-preview006 | 69 | 7/30/2024 |
0.5.0-preview005 | 98 | 7/27/2024 |
0.5.0-preview004 | 88 | 7/15/2024 |
0.5.0-preview003 | 111 | 6/6/2024 |
0.5.0-preview002 | 103 | 6/5/2024 |
0.5.0-preview001 | 99 | 6/4/2024 |
0.4.0 | 98 | 5/19/2024 |
0.4.0-preview006 | 81 | 5/19/2024 |
0.4.0-preview005 | 103 | 5/12/2024 |
0.4.0-preview004 | 102 | 5/12/2024 |
0.4.0-preview003 | 105 | 5/11/2024 |
0.4.0-preview002 | 124 | 5/8/2024 |
0.4.0-preview001 | 113 | 5/5/2024 |
0.3.1-preview001 | 100 | 4/26/2024 |
0.3.0 | 116 | 4/23/2024 |
0.3.0-preview002 | 98 | 4/23/2024 |
0.3.0-preview001 | 110 | 4/23/2024 |
0.2.2-preview010 | 117 | 4/11/2024 |
0.2.2-preview009 | 98 | 3/18/2024 |
0.2.2-preview008 | 96 | 3/18/2024 |
0.2.2-preview007 | 110 | 3/16/2024 |
0.2.2-preview006 | 89 | 3/11/2024 |
0.2.2-preview005 | 95 | 3/10/2024 |
0.2.2-preview004 | 94 | 3/10/2024 |
0.2.2-preview003 | 140 | 1/22/2024 |
0.2.2-preview002 | 110 | 1/18/2024 |
0.2.2-preview001 | 113 | 1/14/2024 |
0.2.1 | 190 | 1/7/2024 |
0.2.0 | 116 | 12/31/2023 |
0.2.0-preview009 | 89 | 12/31/2023 |
0.2.0-preview008 | 90 | 12/30/2023 |
0.2.0-preview007 | 98 | 12/28/2023 |
0.2.0-preview006 | 89 | 12/27/2023 |
0.2.0-preview005 | 90 | 12/25/2023 |
0.2.0-preview004 | 98 | 12/23/2023 |
0.2.0-preview003 | 98 | 12/20/2023 |
0.2.0-preview002 | 87 | 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.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-01-14 22:24:22 +0300
Hash: efdae18604a33651bb9a9196db3a3b3696b93def