Skip to content

The lambda factories leave the kernel: Predicate.Of and KeyTarget.Of take no provider and spell SQL as Npgsql does #112

Done
1 of 1 issue completed

Description

@CaffeinatedCoder

Decided 2026-11-24 with #114: point 2. Predicate and KeyTarget.Template are one type with two states, unbound before the model is finalized and bound after. Neither shows its SQL as a public string and neither is made from text with new; unmarked stay And, equality and a ToString() for a message. Raw SQL comes in through the provider's factory, and a contributor reads the segments through the marked contract. The other two refusals of point 3 become support with the binder's third slice.


Before preview.2, with #114. Moved there by the maintainer on 2026-11-17. From the architecture debate of 2026-11-14.

Where it stands. Point 1 shipped in preview.1 with #132: the factories take the provider's spelling and carry the contract's mark. Point 3's first refusal, a value-changing cast, shipped with #103. What is left is point 2 and the other two refusals of point 3, which the binder of #114 makes possible. GPT's condition on #2 (the binder first unless the value API can be settled so that binding changes no public answer) is answered by the decision on #9: a preview promises nothing, so KeyTarget and Predicate may change their public members in preview.2, and preview.1's README and changelog say so.

Problem

KeyTarget.Of(LambdaExpression) and Predicate.Of<TEntity>(…) are public statics of the kernel with no experimental mark. They take no provider and call LambdaTranslator, whose spellings are Npgsql's, character for character: || over coalesced operands, substring, the trim characters as E'…', literals as PostgreSQL writes them. A declaration for SQL Server built through them would store PostgreSQL's text. CLAUDE.md says SQL Server's spellings come with #29; by then the entry points have shipped.

The same two types carry Template as a public string and are built with new and with, which is how a hand-written template reaches the resolver's scanner (#83, and the notes on #43).

Change, to decide

  1. Done in The lambda factories take the provider's spelling and carry the contract's mark #132. The factories that take a lambda are the provider package's: PgSchema<T> has them already, and the kernel's statics become internal or take the provider's spelling as an argument. Whoever spells the SQL is the active provider's package.
  2. What Predicate and KeyTarget show a consumer is settled now, so that binding at model finalization (the binder's issue) changes no public answer later: which members are the logical value a consumer wrote, and which are the stored, rendered form.
  3. A value-changing cast (A narrowing cast in a lambda is left out of the template: (int)x.Amount == 2 is stored as {Amount} = 2 #103), a literal compared with a converted property unless the converter is the member itself, and a path whose column is nullable while the lambda's type says it is not, are refused until the binder can do them right.

Done when

No unmarked public member of the kernel produces provider-specific SQL without being given the provider, PublicSurfaceTests holds it, and ConsumerCompileTests compiles a consumer's declaration through the provider's factory alone.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added this to the 11.0.0 milestone on Nov 14, 2026
  2. added
    enhancement
    breaking
    package/core
    package/postgresql
    on Nov 14, 2026
  3. added
    area/expression-indexes
    on Nov 14, 2026
  4. CaffeinatedCoder commented on Nov 25, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Done. Point 1 shipped with #132; point 2 with #178 and #179 (Predicate and KeyTarget.Template hold a SqlTemplate with two states and show no SQL string); point 3's refusals became support with #180; and the kernel holds no spelling since #184 (PR #186). PublicSurfaceTests holds that nothing public in the kernel takes a lambda without a spelling, that the kernel has none of its own, and that no public name of it names a provider.

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