CodoMetis.TypeKit.EntityFrameworkCore 2.4.0-preview.1

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

CodoMetis.TypeKit.EntityFrameworkCore

Use CodoMetis.TypeKit value objects in EF Core 10 or 11 with one line of setup. Every value object is stored in a plain column of its underlying type, with nothing to register per type, and .Value works in a LINQ query the way it does in memory.

dotnet add package CodoMetis.TypeKit.EntityFrameworkCore

This page is the reference for the package. For a walk through a whole model, read the EF Core guide.

Good to know

  • It needs EF Core 10.0.12 or later on .NET 10, and EF Core 11.0.0 or later on .NET 11. A project that references Microsoft.EntityFrameworkCore or Microsoft.EntityFrameworkCore.Relational directly at an earlier version fails to restore with NU1605 (a package downgrade). Raise the EF Core packages to that version or later.
  • On .NET 11, raise your database provider to 11 too. NuGet doesn't stop a provider of the 10 line that is your only EF Core reference, such as Microsoft.EntityFrameworkCore.Sqlite 10. The project restores and builds with EF Core 11 under it, and the provider throws MissingMethodException or TypeLoadException the first time you use it.
  • The generators stay in your domain project. This package recognises a value object at run time by the attribute the generators put on it. So the project that hosts the DbContext needs only this package and the base package. The domain project that declares the value objects references CodoMetis.TypeKit.Generators.

Setup

services.AddDbContext<ShopDb>(options =>
    options.UseNpgsql(connectionString)
           .UseTypeKit());

UseTypeKit() adds plugins to EF's type mapping, model conventions and query translation. It replaces nothing. So it works alongside a provider or a library that replaces EF's converter selector, and it doesn't matter whether you call it before or after UseNpgsql or UseSqlite. It lives in the Microsoft.EntityFrameworkCore namespace, beside UseNpgsql, so it needs no using of its own.

If your application builds EF's internal service provider itself, register the same services there:

var internalServices = new ServiceCollection()
    .AddEntityFrameworkNpgsql()
    .AddEntityFrameworkTypeKit()
    .BuildServiceProvider();

Good to know

  • It needs a relational provider. EF's in-memory provider has no relational type mapping, so nothing is mapped there. A struct value object is stored as it is, a class value object fails the model, and an integer key has no value generator (SaveChanges throws NotSupportedException). For a database in memory in tests, use SQLite's (Data Source=:memory:).

What maps

public class Order
{
    public required OrderId Id { get; init; }              // key: uuid
    public required CustomerId CustomerId { get; set; }    // foreign key: uuid
    public required ProductCode Code { get; set; }         // text, keeps HasMaxLength(10)
    public Discount? Discount { get; set; }                // nullable integer
    public required Amount Total { get; set; }             // numeric
    public required PlacedAt PlacedAt { get; set; }        // timestamp with time zone on PostgreSQL
    public List<Tag> Tags { get; set; } = [];              // primitive collection: text[] on PostgreSQL, JSON elsewhere
}

Keys, foreign keys, nullable properties, primitive collections and query parameters all map as plain columns of the underlying type. A facet you configure on the property, such as a maximum length or a column type, is kept. (required is what the analyzer's CMTK0006 asks for. A value object nothing assigns would be a default instance.)

A property can still name the converter explicitly:

modelBuilder.Entity<Order>().Property(o => o.Code).HasConversion<ValueObjectConverter<ProductCode, string>>();

Keys

A single-column key over an integer is generated on add, like a key of that integer type. That's EF's own list: int, long, short, sbyte, uint, ulong and ushort, and not byte.

Whether a value then gets generated is up to the provider, as for a plain key. On PostgreSQL and SQL Server it's an identity column, so switching an int key to a value object changes no schema there. Where the provider has no identity for the type, the key isn't generated, just as a plain one isn't. On PostgreSQL, for example, a ulong is a numeric(20,0), which can't be an identity.

At Add, a key that is generated gets the same temporary value a plain key of the underlying type gets, also where the column is of another type, such as the decimal that holds a ulong. HiLo and a value generator of your own still come first. There are three exceptions:

  • A key over char is yours to assign. It's never generated, on any provider, because none generates a char key. PostgreSQL rejects an identity on character(1), SQLite an AUTOINCREMENT on TEXT, and SQL Server has no identity for nvarchar(1). On SQL Server, Add used to give the value object one character of a GUID string, which was then stored. TypeKit stops that invented value, but it doesn't check that you set a meaningful one. A default key, '\0', is stored as it is, and a second such row fails on the primary key. ValueGeneratedOnAdd() or a value generator of your own on the property still applies.
  • On EF Core 10, a default key over ulong can still throw at Add where the column is a decimal (SQL Server, PostgreSQL), in two cases. One is a compiled model made with dotnet ef dbcontext optimize --nativeaot, which writes each column's mapping out as code and loses what gives the key a temporary ulong. The other is a key you configure with ValueObjectConverter yourself. EF's temporary value for the column is then a negative decimal, and converting it back throws OverflowException. Otherwise the key gets a temporary ulong, as a plain one does. In those two cases, configure ValueGeneratedNever() on the key and assign it. On EF Core 11 neither case throws: the key gets its temporary ulong in both.
  • On EF Core 11, SQL Server's HiLo isn't chosen for a key over ulong. EF Core 11 leaves TypeKit one place to give that key its temporary ulong, a generator factory on the property, and SQL Server takes such a factory before HiLo. SaveChanges then fails, because the column has no identity. Clear the factory on the key and HiLo is chosen again: Property(o => o.Id).Metadata.SetValueGeneratorFactory((Type?)null). On EF Core 10 you need nothing: HiLo comes first there.

A key over a Guid is yours to assign, Id = OrderId.New() (a version 7 Guid, which sorts by creation time), and EF inserts it as given. To have EF generate it instead, configure ValueGeneratedOnAdd() on the property. It's then generated as a plain Guid key is: a version 7 Guid on PostgreSQL, one that's sequential in SQL Server's order on SQL Server. EF then also treats an entity whose key is already set, reached through a navigation, as an existing one.

The root of an inheritance hierarchy follows the same rules under TPH and TPT. Under TPC, as for an int key, the key is generated only where the provider numbers the whole hierarchy from a sequence (PostgreSQL, SQL Server), an abstract root's included. SQLite has no such sequence, so there you assign it.

Name the value object itself in a key or an index: HasKey(o => o.Id) and HasIndex(o => o.Code), not o.Id.Value. EF Core 11 reads HasKey(o => o.Id.Value) as a key inside a complex type, and would store the value object as one, in a column Id_Value that TypeKit doesn't map. UseTypeKit() stops the model there and names the property. On EF Core 10, EF rejects that path itself. In a query, .Value still reads the column.

A configuration you write yourself always wins over these defaults.

SQLite: configure integer keys with UseAutoincrement()

modelBuilder.Entity<Invoice>().Property(i => i.Id).UseAutoincrement();

SQLite fills such a key in. But EF's SQLite provider makes a key AUTOINCREMENT only when the property's CLR type is an integer, and a value object isn't one. A migration snapshot records the column as an int, which is. So without this configuration the model never matches its snapshot:

  • Every migration repeats an AlterColumn, which is a table rebuild on SQLite.
  • migrations has-pending-model-changes always reports changes.
  • Migrate() throws for PendingModelChangesWarning.

Configure each such key, as above. A model that also runs on another provider does this under if (Database.IsSqlite()).

Model-wide conventions follow the property's type

EF applies ConfigureConventions by CLR type. So configurationBuilder.Properties<decimal>().HavePrecision(18, 2) reaches decimal properties, and not an Amount that wraps one. Configure the value object instead: configurationBuilder.Properties<Amount>().HavePrecision(18, 2).

Closed sets

A closed set (IClosedSet<TSelf>) is stored as a text column of the member's name, and read back as the member itself. That holds in a table, in a primitive collection of names (text[] on PostgreSQL, a JSON array elsewhere) and in a JSON column alike, with nothing registered per set.

A name the set no longer has throws when it's read, rather than reading as null. An instance that isn't a member throws when it's written. ClosedSetConverter<TSet> names the converter for an explicit configuration.

Option and Result are not columns

EF can't map them, and building the model fails with an error that says so. Declare an optional value as T? on the entity, and call ToOption() where your domain wants an Option.

Queries

db.Orders.Where(o => o.Id == id);                            // WHERE o."Id" = @id
db.Orders.Where(o => ids.Contains(o.Id));                    // WHERE o."Id" = ANY (@ids)
db.Orders.Where(o => o.Code.Value.StartsWith("A"));          // WHERE o."Code" LIKE 'A%'
db.Orders.Where(o => o.Total.GetValue() > 100m);             // WHERE o."Total" > 100.0
db.Orders.Where(o => o.Discount.ValueOrNull() > 10);         // WHERE o."Discount" > 10
db.Orders.Where(o => o.Tags.Contains(tag));                  // WHERE @tag = ANY (o."Tags")
db.Orders.Where(o => o.Tags.Any(t => t.Value == "x"));       // WHERE EXISTS (SELECT 1 FROM unnest(o."Tags") AS t(value) WHERE t.value::text = 'x')
db.Orders.OrderBy(o => o.PlacedAt);

The comments are the SQL EF Core 10 writes. EF Core 11 leaves out a cast that changes nothing, so there the query over Tags ends in WHERE t.value = 'x'.

.Value, GetValue() and ValueOrNull() translate to the column itself. So the underlying type's own operations work on it: StartsWith, arithmetic, comparisons. Use ValueOrNull() for an optional value object, where .Value would first unwrap the Nullable.

A table's column is re-typed, not cast, so an index on it still serves the query. These are converted instead, which works everywhere and may add a cast:

  • the element of a primitive collection (o.Tags.Any(t => t.Value == "x"));
  • a property mapped into a JSON column;
  • a parameter.

Good to know

  • .Value translates only where the column holds the underlying value. That's where TypeKit's converter stores it: the one UseTypeKit() applies, or ValueObjectConverter<,> named in HasConversion. A property your application converts itself (HasConversion(c => "C:" + c.Value, ...), a converter type, a conversion in ConfigureConventions) doesn't hold .Value. So a filter, a sort, a grouping or an aggregate that reads .Value there fails with EF's "could not be translated", rather than comparing against what the column really holds. Selecting .Value as the query's last step still works, Distinct included: EF reads the value object through your converter and takes .Value in memory. Comparing the value object itself (o.Code == code) goes through that converter and still works.

  • Ordering in SQL follows the database's collation for the column. The generated comparison in memory is ordinal for a string, as it is for any string column.

  • A null passes no <, <=, > or >= in the database. SQL leaves out a row whose column is NULL, as it does for an int? column. A value object that's a record class puts null first in memory, so there null < rank is true. For a nullable Rank record class, o.Rank < rank keeps an order without a rank in a list, and leaves it out of the query. Write o.Rank == null || o.Rank < rank to keep it in the query too. A struct value object answers the same both ways.

  • Your own CompareTo(TSelf) can't run in the database. A value object that declares one orders in memory by that method. The column orders by the underlying value, which could be the opposite of a descending CompareTo. So these queries throw an InvalidOperationException naming the value object:

    • a comparison (<, >, <=, >=, CompareTo);
    • an ordering (OrderBy, ThenBy, their descending forms, Order);
    • the database's own orderings: EF.Functions.Greatest and Least, and a row-value comparison such as Npgsql's EF.Functions.GreaterThan((o.Priority, o.Id), (priority, id));
    • Min or Max.

    That holds when the value object is cast to object first, as in Select(o => (object)o.Priority).Max(), and when the cast value reaches the ordering another way, through ??, a member of a projection, a grouping's key, a join or a subquery's First(), as in Select(o => new { Key = (object)o.Priority }).OrderBy(a => a.Key): EF drops the cast, while memory still orders by your CompareTo.

    Compare or order by .Value where the underlying value's order is what you mean (OrderBy(o => o.Priority.Value)), or order in memory after the query. Equality isn't ordering, and stays allowed. A query filter (HasQueryFilter, named or not) that does the same fails when the model is built, naming the entity type, since it applies to every query of that type.

  • A value object's arithmetic runs as the underlying type's. The operators TypeKit generates (Add, subtract and scale) work in a query. o.Price * 2m > limit keeps the rows memory keeps, and o.Tax / o.Price reads a decimal. The database computes them, on SQLite, PostgreSQL and SQL Server alike.

  • Your own operator can't run in the database. EF reads o.Price + o.Tax as the database's own addition of the two columns and never calls your +. Whatever your operator does beyond that, such as rounding, would be skipped. So a query that uses an arithmetic or bitwise operator you wrote on a value object, && and || included, throws an InvalidOperationException naming the value object. Compute it from .Value where the underlying type's arithmetic is what you mean (o.Price.Value + o.Tax.Value), or do it in memory after the query. A query filter that uses one fails when the model is built. An operator over values you pass in, which EF computes before the query, stays allowed.

  • Over a byte, short or char, an operator throws as well, naming the value object. C# computes their arithmetic as an int's, and EF has no expression for theirs.

  • Over a column your own converter stores, an operator isn't translated, as .Value isn't: the column doesn't hold the underlying value, so EF's "could not be translated" is the answer. As the query's last step, a Select still works: EF computes it in memory.

    One exception: a filter may order values your context holds, without a lambda, as in HasQueryFilter(o => o.Priority == Limits.Max()). EF works that out in memory, by your CompareTo. With a lambda, as in Limits.OrderByDescending(l => l).First(), EF orders those values in the database, so that filter fails too.

On SQL Server

A value object behaves on SQL Server as the type inside it does there. That isn't always how it behaves in memory:

  • Text compares ignoring case. Under SQL Server's default collation, o.Note == note, notes.Contains(o.Note) and StartsWith also match text that differs in case or in trailing spaces. OrderBy sorts ignoring case too. In memory, a value object over text equals only the same text, exactly. Where case matters, give the column a binary collation: UseCollation("Latin1_General_BIN2").
  • Guids sort by their last group. SQL Server orders a uniqueidentifier by its last six bytes first. So OrderBy, < and Min over Guids come out in another order than in memory.
  • A decimal without a precision is a decimal(18,2). It reads back with two decimal places: 10m comes back as 10.00m, which is equal but prints 10.00. More decimal places are rounded when the value is written. Configure the precision you need, on the property with HasPrecision or for every such value object with configurationBuilder.Properties<Amount>().HavePrecision(18, 4).
  • A TimeSpan must be shorter than a day. It's stored as time. A longer one fails SaveChanges in a column. In a JSON column it's stored, but a query that reads it gets another value, 01:02:00 for 1.02:00:00, without an error. Store a longer duration as a number instead, such as a value object over the seconds as a long.
  • EF.Functions.Greatest and Least need compatibility level 160. Configure it with UseSqlServer(connectionString, sql => sql.UseCompatibilityLevel(160)). Below it, EF refuses them.
  • A DateTime comes back without its kind. datetime2 keeps every tick, and a UTC value reads back with Kind Unspecified. It's still equal to the value you wrote.

The mapping is tested on SQLite, PostgreSQL and SQL Server. The SQL of each translation is pinned on PostgreSQL. Every family of underlying types makes a round trip through a real PostgreSQL and a real SQL Server, and every query and key shape of the test catalogue runs on the real SQL Server too.

An Option for nothing found

Option<Order> order = await db.Orders.FirstOrNoneAsync(o => o.Id == id);   // the database runs the condition and returns one row
Option<Order> earliest = db.Orders.OrderBy(o => o.PlacedAt).FirstOrNone(); // the same, synchronous
Result<Order, OrderFault> found = db.Orders.FirstOrError(o => o.Id == id, OrderFault.NotFound);

These ask the database for one row and let it run the condition:

  • FirstOrNoneAsync, and the base package's FirstOrNone and FirstOrError on a query, read one row: WHERE ... LIMIT @p. FirstOrDefaultAsync would hand back a default value object when nothing is found (CMTK0009).
  • SingleOrNoneAsync and SingleOrNone ask for two rows, and throw for more than one.
  • ElementAtOrNone skips to its row: OFFSET @p.

Good to know

  • The condition must be an expression. A lambda written at the call is one. A Func<Order, bool> held in a variable, or a method group, binds FirstOrNone, SingleOrNone and FirstOrError to their overloads on a sequence. Then every row is read and the condition runs in memory, and the analyzer warns at the call (CMTK0009). Hold an Expression<Func<Order, bool>> instead. FirstOrNoneAsync takes only an expression, so a Func there doesn't compile.
  • LastOrNone and LastOrError on a query don't compile. A query has no last row until it's ordered. So order it the other way and take the first, or call AsEnumerable() to read every row on purpose.
  • Under Native AOT these throw "Query wasn't precompiled" (measured with EF Core 10.0.12). EF runs only the queries it precompiled, and it precompiles a query where your application calls one of EF's own operators, which these helpers aren't. Write Where(...).Take(1).ToListAsync() at the call site instead, and take the first element of the list.

Reading back skips validation

var orders = await db.Orders.AsNoTracking().ToListAsync();
foreach (var order in orders.Where(o => o.Code.Revalidate().State == ResultState.Error))
    log.StoredCodeNowRefused(order.Id);

EF reads a column back without validation, through IValueObjectMaterializer<,> rather than Create. A rule you add to a value object later shouldn't make the rows written before it unreadable. And the database holds what your application wrote, so it's trusted.

Input still goes through Create. Nothing in this package can be reached from a request, and calling Materialize anywhere else gets reported by the analyzer (CMTK0004).

When you add a rule, Revalidate() finds the rows it rejects, as above.

Compiled models and Native AOT

dotnet ef dbcontext optimize --precompile-queries --nativeaot

EF Core runs under Native AOT only through a compiled model and precompiled queries, and it supports that experimentally. UseTypeKit() works there. In the native binary:

  • Value objects and closed sets map through the compiled model, a JSON column included.
  • .Value translates in precompiled queries.
  • A value-object or closed-set parameter binds.
  • A stored value reads back without the rules.
  • A key over an integer is generated by the database.

The consumer smoke test runs exactly that. A compiled model without Native AOT works the same way. This package adds no trim or AOT warning of its own. EF's DbContext constructors report theirs, which EF's documentation covers.

Five EF limitations to know, measured with EF Core 10.0.12:

  • A struct value object that wraps a reference type (string, Uri) can't be a property in a compiled model. EF can't write its sentinel, since default(ProductCode) converts to null, and dbcontext optimize fails with "The type mapping for 'ProductCode' has not implemented code literal generation". Declare such a value object as a sealed partial record.
  • A sealed entity class doesn't compile in EF 10's precompiled queries (CS0030 in the generated interceptors).
  • Precompiled queries need the converter UseTypeKit() composes. They cast a property's converter to the type it had at design time. The compiled model doesn't recreate that for a ValueObjectConverter<,> or a ClosedSetConverter<> named in HasConversion.
  • Precompiled queries compile the project they're in without the generators' bodies. --precompile-queries reads the generated members as declarations only. So a value object or a closed set declared in that project fails it (CS0534, CS0177 in the generated code). Declare them in another project, as a domain library usually is.
  • A collection of converted elements can't be read by a precompiled query. That's a List<OrderId> or a List<OrderStatus> as much as a List<DayOfWeek> stored as text by EF's own converter. Precompilation fails with Encountered a constant of unsupported type 'ValueConverter`2'. An entity with any primitive collection, a List<string> too, fails to materialize in a precompiled query (a BadImageFormatException from an accessor EF generates). A query compiled at run time, without Native AOT, handles both.
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.  net11.0 is compatible. 
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
2.4.0-preview.2 0 11/30/2026
2.4.0-preview.1 0 11/30/2026
2.3.1 715 10/31/2026
2.3.0 412 10/29/2026
2.2.0 754 10/18/2026
2.1.0 1,293 10/15/2026
2.0.0 194 10/14/2026
1.5.1 142 10/11/2026
1.5.0 123 10/11/2026
1.0.0 151 9/28/2026

Added

- Generators: a plain value object that declares IAdditionOperators, ISubtractionOperators, IMultiplyOperators, IDivisionOperators, IModulusOperators, IUnaryNegationOperators or IUnaryPlusOperators gets their operators, Money + Money or Money * 3m, each the underlying type's own, overflow and checked context included; nothing without the interface, nothing on a validated value object, and an operator you wrote is kept (Add, subtract and scale (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/docs/value-objects.md#add-subtract-and-scale)).
- EF Core: those operators run in a query as the underlying type's arithmetic on SQLite, PostgreSQL and SQL Server, o.Price * 2m > limit and o.Tax / o.Price included (Queries (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.EntityFrameworkCore/README.md#queries)).
- Generators: every member the generators add carries [GeneratedMember] from CodoMetis.TypeKit.CompilerServices, naming the interface member it implements, such as IParsable<OrderId>.Parse, so code that reads members can tell generated from hand-written without a list of names. A value object's ToString() doesn't carry it: Metalama can't put an attribute there.

Changed

- Generators: the package requires Metalama 2027.0, a preview until Metalama releases it (2027.0.9-preview), where 2.3.x requires 2026.1.30. So 2.4.0 is a preview until then, and isn't for production. A project that references Metalama.Framework 2026.1 itself fails to restore with NU1605: raise that reference, or stay on 2.3.x.
- EF Core: the package has a net11.0 asset that requires Microsoft.EntityFrameworkCore.Relational 11.0.0, where net10.0 still requires 10.0.12. So a net11.0 project gets EF Core 11, and its provider has to be 11 too: raise it, or stay on 2.3.x with EF Core 10. NuGet tells you only sometimes. A project that references Microsoft.EntityFrameworkCore or Microsoft.EntityFrameworkCore.Relational 10 itself fails to restore with NU1605, and one on Npgsql's 10 provider with NU1107. One that references only Microsoft.EntityFrameworkCore.Sqlite or .SqlServer 10 restores and builds, and throws when it first uses the provider (MissingMethodException, TypeLoadException). On EF Core 11, SQL Server's HiLo isn't chosen for a key over ulong until you clear the generator factory on it (Keys (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.EntityFrameworkCore/README.md#keys)).
- ASP.NET Core: the package has a net11.0 asset that requires Microsoft.AspNetCore.OpenApi 11.0.0, where net10.0 still requires 10.0.12. A net11.0 project that references the 10 line itself fails to restore with NU1605: raise that reference, or stay on 2.3.x with the 10 line.
- Packages: the public surface is checked against 2.3.1's, so nothing 2.3.1 ships is removed or changed in 2.4.0.
- Analyzers: CMTK0005 now also warns at CollectionsMarshal.SetCount(ids, count) on a List<OrderId>, which makes room for count items without putting one there, as new OrderId[count] does; a constant count of zero isn't reported. In a build that treats warnings as errors, that can report code that built before (CMTK0005 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.Analyzers/README.md#cmtk0005)).
- Analyzers: CMTK0009 now warns at LeftJoin, RightJoin and .NET 11's FullJoin whose side with no match is a value object, Result or [RequireCustomInitialization] struct, which the join fills with default; the message names an Option of each element, or a nullable projection in a query. In a build that treats warnings as errors, that can report code that built before (CMTK0009 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.Analyzers/README.md#cmtk0009)).
- Core: on .NET 11 System.Text.Json refuses an Option, a Result or a fault as a dictionary key itself, before TypeKit's converter is asked, so the NotSupportedException is the serializer's own sentence, without the link; nothing is written or read either way (Option or Result in JSON (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit/README.md#option-or-result-in-json)).

- Generators: a property, field or nested type you wrote with the name of a generated member, on the value object, a closed set or a base of either, such as public static int Parse => 1, now fails with CMTK1011 naming it, where it failed with a Metalama error (LAMA0506, LAMA0531) that named nothing you wrote. So does a closed set's own method named as a generated property, such as Name() (Write your own members (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.Generators/README.md#write-your-own-members)).

Fixed

- Generators: a web project builds where the .NET 11 SDK is the only SDK installed, and with Microsoft.AspNetCore.OpenApi 11 on any machine. 2.3.x fails both with LAMA0625, and a .NET 10 SDK beside the .NET 11 SDK helps only without OpenAPI 11. To stay on 2.3.x, put PrivateAssets="all" on your domain project's reference to the generators, or reference Metalama.Framework 2027 beside them; with OpenAPI 11, move to 2.4.0 (LAMA0625 in a web project (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.Generators/README.md#lama0625-in-a-web-project), #275 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/275)).
- EF Core: on EF Core 11, a key over ulong that is a member of a complex type, HasKey(o => o.Identity.Id), gets its temporary value at Add as a plain ulong key there does. It threw OverflowException on SQL Server and PostgreSQL (#303 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/303)).
- EF Core: on EF Core 11 the package threw MissingMethodException for the first value object EF mapped, because EF Core 11 removed a constructor it called. The net11.0 asset is built against EF Core 11, and there a default key over ulong gets its temporary value in a --nativeaot compiled model and with ValueObjectConverter named by hand too (#285 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/285)).
- ASP.NET Core: with Microsoft.AspNetCore.OpenApi 11 the OpenAPI document answered 500, a MissingMethodException from the fault responses, because Microsoft.OpenApi 3 changed the type of a response's content. The net11.0 asset is built against it (#286 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/286)).
- ASP.NET Core: on ASP.NET Core 11, an endpoint that declares ProblemDetails and another type for one status a fault answers, such as .Produces<ProblemDetails>(404).Produces<Order>(404), gets fault and rule described on the problem alone. ASP.NET Core 11 writes the two as an anyOf, and the two members were put on the anyOf itself (#299 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/299)).
- EF Core: a value object over a Guid or a string that is declared generated and is no key, ValueGeneratedOnUpdate() or ValueGeneratedOnAdd() on a column a trigger fills, is no longer given a Guid at insert. It is left as the plain property is: EF generates a value only for a key (#288 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/288)).
- Generators: a value object, a closed set or a fault set is a case of a C# 15 union for System.Text.Json under reflection too, as under a source-generated context. On .NET 11 writing one threw JsonException, because the generators marked your type [CompilerGenerated]; now only the members they add carry it, and the attribute is yours to write (#296 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/296)).
- Generators: an overload that differs from a generated member only by a nullable value type, such as a base record's TryFrom(int?) over an int or a closed set's Parse(string, bool?), a base record's method named as a generated property, such as MinValue(), and an overload of a private entry point are kept beside the generated member, where the build failed with CMTK1011 (Write your own members (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.Generators/README.md#write-your-own-members)).
- EF Core: a query that uses an arithmetic or bitwise operator a value object declares by hand, && and || included, throws, naming the value object, where the database ran its own arithmetic and skipped the operator; a query filter fails when the model is built (Queries (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.EntityFrameworkCore/README.md#queries)).
- EF Core: on EF Core 11, HasKey(o => o.Id.Value) or HasIndex(o => o.Code.Value) over a value object now stops the model when it is built, naming the property and the fix, HasKey(o => o.Id). EF Core 11 reads that path as a key or an index inside a complex type, and stored the value object as one, in a column Id_Value, without a word (Keys (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/v2.4.0-preview.1/src/CodoMetis.TypeKit.EntityFrameworkCore/README.md#keys), #301 (https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/issues/301)).

Full changelog: https://github.com/CaffeinatedCoder/CodoMetis.TypeKit/blob/main/CHANGELOG.md