Skip to content

The contributor contract and the declaration store: ISchemaContributor, Declare, Redeclare, the annotation key and value #45

Closed

Description

@CaffeinatedCoder

Part of preview.1, and the first slice of #7 and #9, which stay open for what is listed at the end. Plan, sections 3.4, 3.6, 3.7 and 3.10.

Problem

The host splices what a planner returns, and the only planner is the tests' stand-in. There is no type a declaration could be, nowhere to store one, and no contract a contributor could implement. The two belong together: a declaration is stored as a contributor's value, and the store's key rule is the contract's identity rule.

Change

In src/CodoMetis.EFCore.SchemaKit, public and [Experimental("SK9001")]:

  • ISchemaObject and ISchemaDeclaration<TSelf>, the codec as static abstract members, so the read model needs no service provider.
  • The store on IMutableEntityType: Declare, Redeclare, GetDeclarations<T>(), FindDeclaration<T>(name). Declare asks for the wiring stamp first.
  • The key rule: CodoMetis:{Owner}:{hash}, over kind and explicit name when named, over kind and every non-operational property when not. Declare throws on a key that is taken; Redeclare computes every resulting key before it changes anything.
  • The stored value: a hand-written JSON writer with a fixed order, $kind, the format version v, the resolution epoch r. Nothing is omitted but a null, and the reader has no default.
  • ISchemaContributor, SchemaContributor<TDeclaration, TDescriptor> with its dependencies record, ISchemaDescriptor with Scope, Name and Dependencies, the closed SchemaChange, Impact, BaseChange, Dependency, NameClaim and SchemaPlacement. Plan and ImpactOf are mandatory.
  • A registration that adds a contributor without touching the two EF services.

Done when

  • The contract probes hold against the shipping assembly: rendering from a declaration, a missed case of one's own union, a raw name in DDL, a contributor without Plan or ImpactOf, a foreign case of a kernel union.
  • Every declaration of a sample contributor round-trips through its annotation exactly, and through a real generated snapshot compiled with Roslyn, on the three providers.
  • A convention test holds the omitted-default rule for the writer as a whole.
  • PublicSurfaceTests lists the new types, all experimental.
  • Each rule is shown to fail its tests when it is removed.

Not in this slice

Activity

  1. added this to the 11.0.0 milestone on Nov 11, 2026
  2. added
    enhancement
    package/core
    area/migrations
    on Nov 11, 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/migrationsenhancementpackage/core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions