Support ComplexType property for temporal table validity CLR mapping

Open
#39,564 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp
Domain
databases

Research direction

Start by tracing the temporal table configuration entry point for HasPeriodStart and how it validates member access expressions; the reported failing expression is x => x.Validity.From. Check the existing tests for temporal period properties and complex type mappings. Done when a ComplexType property can be used for PeriodStart without the reported exception and the behavior is covered by a test.

Written by the indexing model from the issue text.

Description

area-complex-types area-model-building area-temporal-tables customer-reported
What problem are you trying to solve?

Currently, trying to map the PeriodStart column to a ComplexType property like this:

modelBuilder.Entity<People.Person>().ToTable("Person", table => table.IsTemporal(temporal => {
    temporal.HasPeriodStart(x => x.Validity.From);
}));

results in an exception like this:

System.ArgumentException : The expression 'x => x.Validity.From' is not a valid member access expression. The expression should represent a simple property or field access: 't => t.MyProperty'. (Parameter 'memberAccessExpression')
Describe the solution you'd like

ComplexType-Expressions should be supported for mapping.

Dominant language
C#
Stars
14.8k
Forks
3.5k
Avg merge
3d 7h
Merged PRs (30d)
182

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.