JoinRpg.Common.EntityFrameworkCore 2026.9.651

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

JoinRpg.Common.EntityFrameworkCore

Хранит типизированные Id из JoinRpg.Common.PrimitiveTypes (и свои, сгенерированные [TypedEntityId]) в колонках EF Core как обычные числа, и регистрирует DbContext для PostgreSQL (AddJoinEfCoreDbContext).

dotnet add package JoinRpg.Common.EntityFrameworkCore

Нужен net10.0 и EF Core 10.

using JoinRpg.Common.EntityFrameworkCore;
using JoinRpg.Common.PrimitiveTypes;

public class MyDbContext(DbContextOptions options) : DbContext(options)
{
    protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
    {
        // GameIdentification — свой [TypedEntityId] с одним int
        configurationBuilder.Properties<GameIdentification>()
            .HaveEntityIdValueConversion<GameIdentification, int>();
        configurationBuilder.Properties<UserIdentification>()
            .HaveEntityIdValueConversion<UserIdentification, int>();
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        // ... настройка сущностей ...

        // Ключ с конвертером EF сам identity не делает — включаем, как у int-ключа.
        modelBuilder.EntityIdsSetValueGeneratedOnAdd();
    }
}
  • HaveEntityIdValueConversion<TId, TValue>() — вызывать в ConfigureConventions. Без конвертера EF примет свойство такого типа за навигацию к новой сущности. TValue (int или long) указывается явно, вывести его компилятор не может.
  • EntityIdsSetValueGeneratedOnAdd() — вызывать в конце OnModelCreating: сущности, настроенные после вызова, он не затронет. Делает identity все ключи из одного типизированного Id, в том числе внешние (UserIdentification с id.joinrpg.ru) — таким после вызова верните ValueGeneratedNever().

Составные Id (GamePlayerId(5-12)) конвертера не получают: храните их части отдельными колонками.

Регистрация DbContext

AddJoinEfCoreDbContext регистрирует DbContext для PostgreSQL: провайдер Npgsql, EntityFramework.Exceptions (бизнес-исключения вместо DbUpdateException), лог SQL в Debug в dev-режиме и health check {имя строки подключения}-db (Degraded при недоступности базы). Если строки подключения с таким именем нет, ничего не регистрирует и возвращает false — вызывающий решает, критично ли это.

using JoinRpg.Common.EntityFrameworkCore;

services.AddJoinEfCoreDbContext<MyDbContext>(
    configuration, environment,
    connectionStringName: "MyDatabase",
    options => options.UseOpenIddict() // опционально
);
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 JoinRpg.Common.EntityFrameworkCore:

Package Downloads
JoinRpg.Common.WebInfrastructure

ASP.NET Core web infrastructure: Serilog logging, OpenTelemetry, EF Core data protection in PostgreSQL, health checks, midnight job scheduler (contracts in JoinRpg.Common.WebInfrastructure.Interfaces), OIDC login against id.joinrpg.ru.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.9.680 310 11/8/2026
2026.9.668 165 11/8/2026
2026.9.651 210 11/7/2026
2026.9.533 638 10/29/2026
2026.9.438 218 10/27/2026
2026.9.363 103 10/22/2026
2026.9.217 115 10/16/2026
2026.8.421 139 10/4/2026
2026.8.383 130 10/4/2026
2026.8.256 266 9/29/2026
2026.8.12 253 9/6/2026
2026.8.0 172 9/2/2026
2026.7.34 131 8/26/2026
2026.7.32 134 8/26/2026