JoinRpg.Common.EntityFrameworkCore 2026.9.533

dotnet add package JoinRpg.Common.EntityFrameworkCore --version 2026.9.533
                    
NuGet\Install-Package JoinRpg.Common.EntityFrameworkCore -Version 2026.9.533
                    
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.533" />
                    
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.533" />
                    
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.533
                    
#r "nuget: JoinRpg.Common.EntityFrameworkCore, 2026.9.533"
                    
#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.533
                    
#: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.533
                    
Install as a Cake Addin
#tool nuget:?package=JoinRpg.Common.EntityFrameworkCore&version=2026.9.533
                    
Install as a Cake Tool

JoinRpg.Common.EntityFrameworkCore

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

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)) конвертера не получают: храните их части отдельными колонками.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.9.533 88 10/29/2026
2026.9.438 182 10/27/2026
2026.9.363 88 10/22/2026
2026.9.217 101 10/16/2026
2026.8.421 125 10/4/2026
2026.8.383 116 10/4/2026
2026.8.256 209 9/29/2026
2026.8.12 245 9/6/2026
2026.8.0 163 9/2/2026
2026.7.34 125 8/26/2026
2026.7.32 125 8/26/2026