Skip to content

Binder, slice 3: the translator takes nullability and literals from the model #180

Done

Description

@CaffeinatedCoder

2026-11-25: in PR #185 (feat/180-model-facts), with auto-merge on. Offline: 750 of the kernel's tests, 195 of the PostgreSQL package's, 85 of the second provider's. Live: 4 and 73 on PostgreSQL 16 and 18, 86 on SQL Server 2022, the consumer smoke test's 47 rows.

What is there:

  • The translator asks TranslationFacts what a lambda cannot say. At the call they are the C# types', and a value only the model can write is a mark that is never stored. At finalization they are the model's: nullability from the property, a value compared with a property from that property's mapping, asked of the mapping source.
  • Written by the model now, and refused before: an enum against a value (its number, or its name with HasConversion<string>()), a value object through its converter, a DateTime, a Guid. A bool stored as text is compared with what true is stored as, and a negation with what false is.
  • Refused at finalization: an order comparison on what a converter stores as text, and a value the mapping refuses, with the property named.
  • The second binding: first on the finalized model, each declaration is bound again, and a different result is refused. A test registers a convention after SchemaKit's that makes a column nullable.
  • ModelFactsBindingTests compares 13 conditions with EF Core's ToQueryString() for the same lambda on the same model. The parity sweep translates with the model's facts as well: against main it has 72 fewer refusals, 60 more rows that agree and 12 more that differ in the way already waived (NOT (a = b) for a <> b).
  • Eleven rules were removed in turn, and a test failed for each.

Found on the way:

  • On SQL Server a value compared with a property is now SQL Server's own literal (CAST(1 AS bit), N'blocked'), since the mapping writes it. The second provider's tests said the one spelling's TRUE is refused there; that comparison is accepted now.
  • A DateTime that is not UTC cannot be written for Npgsql's timestamp with time zone: the sweep's DateTime rows are still refused, by the mapping.

Not here: the move of the accepted constructs and the spelling to the provider's package, #184.


2026-11-24: started on feat/180-model-facts. The move of the accepted constructs and the spelling to the provider's package is split off as #184: it is a move of its own, with the sweep and the probes reading those tables. This issue keeps the facts from the model and the second binding.


From #179, 2026-11-24: the second binding on the finalized model, with the refusal of a different result, is this slice's. It needs a binding that reads the model to have anything to guard (spike F, Q1).


Part of #114 (decided 2026-11-24). After slice 2. Closes what is left of #112, point 3.

Change

  • Null compensation by the column's nullability in the finalized model, not by the C# annotation.
  • A literal is written by the declared property's type mapping, from the mapping source: a converted property, an enum, a DateTime, a Guid. A property holds no mapping when the model is finalized (spike F, Q1).
  • The accepted constructs and the spelling move to the provider's package.

Done when

An enum comparison, a literal compared with a converted property and a comparison on a nullable column each give the predicate EF Core's query gives, held by the parity sweep on PostgreSQL and on the second provider; the refusals of #112 for them are gone.

Activity

  1. added this to the 11.0.0 milestone on Nov 24, 2026
  2. added
    enhancement
    breaking
    package/core
    package/postgresql
    area/expression-indexes
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/expression-indexesbreakingenhancementpackage/corepackage/postgresql

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions