Skip to content

docs: the temporal foreign key samples do not compile (HasTemporalForeignKey needs both type arguments) #76

Closed

Description

@CaffeinatedCoder

Problem

docs/postgresql-constraints.md (lines 104 and 126) shows

modelBuilder.Entity<SubscriptionAddOn>(b =>
{
    b.HasTemporalForeignKey<Subscription>( … );
});

which fails with CS1061: 'EntityTypeBuilder<SubscriptionAddOn>' does not contain a definition for 'HasTemporalForeignKey' (SDK 10.0.402, EFCore.ComplexIndexes.PostgreSQL 5.5.0 candidate). The method is declared in a C# 14 extension<TEntity>(EntityTypeBuilder<TEntity>) block with its own TPrincipal, so an explicit type-argument list must name both: HasTemporalForeignKey<SubscriptionAddOn, Subscription>(…). The repository's own tests (NpgsqlNameCollisionTests) use the two-argument form. DocumentationApiTests checks that the method name exists, so it cannot see this.

Fix

Use the two-argument form in both samples.

Found by the 5.5.0 consumer probe, which compiled about 45 snippets from the READMEs and docs; this was the only one that did not compile.

Activity

  1. added this to the 5.5.0 milestone on Oct 19, 2026
  2. added
    documentationImprovements or additions to documentation
    package/postgresqlAffects EFCore.ComplexIndexes.PostgreSQL
    area/constraintsTemporal (WITHOUT OVERLAPS, PERIOD) and exclusion constraints
    on Oct 19, 2026
  3. added a commit that references this issue on Oct 20, 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/constraintsTemporal (WITHOUT OVERLAPS, PERIOD) and exclusion constraintsdocumentationImprovements or additions to documentationpackage/postgresqlAffects EFCore.ComplexIndexes.PostgreSQL

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions