Skip to content

Conversation

ajcvickers
Copy link
Contributor

Fixes #11003

This PR introduces a new [PrimaryKey] which follows the same pattern as [Index] in that it is applied to the entity type class and takes an ordered list of property names. It takes precedence over any [Key] attributes on properties, since these may still be needed for OData or other technologies. PrimaryKey and Keyless cannot be used on the same type.

@ajcvickers ajcvickers requested a review from a team March 4, 2022 13:19
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a first round of comments, @AndriySvyryd will probably also want to take a look.

@ajcvickers ajcvickers force-pushed the CompostableKey0302 branch from 312042f to 3cbf8db Compare March 9, 2022 12:42
@ajcvickers ajcvickers requested review from roji and AndriySvyryd March 9, 2022 12:42
@ajcvickers
Copy link
Contributor Author

New version up.

ajcvickers and others added 8 commits March 14, 2022 10:08
Fixes #11003

This PR introduces a new `[PrimaryKey]` which follows the same pattern as `[Index]` in that it is applied to the entity type class and takes an ordered list of property names. It takes precedence over any `[Key]` attributes on properties, since these may still be needed for OData or other technologies. `PrimaryKey` and `Keyless` cannot be used on the same type.
@ajcvickers ajcvickers merged commit 5ae9bb7 into main Mar 14, 2022
@ajcvickers ajcvickers deleted the CompostableKey0302 branch March 14, 2022 11:54
@paulodero
Copy link

Great feature! A much better way to define composite keys in efcore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attribute (Data Annotations) mapping for composite primary keys
4 participants