Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should be disclosed that PrimaryKey(nameof() is a EF Core #7 only attribute #4133

Closed
StijnOttenVMT opened this issue Nov 14, 2022 · 2 comments · Fixed by #4136
Closed

Comments

@StijnOttenVMT
Copy link

In this page it says

You can also configure multiple properties to be the key of an entity - this is known as a composite key. Conventions will only set up a composite key in specific cases - like for an owned type collection.

And then show this code

[PrimaryKey(nameof(State), nameof(LicensePlate))]
Internal class Car
{
    public string State { get; set; }
    public string LicensePlate { get; set; }

    public string Make { get; set; }
    public string Model { get; set; }
}

But the PrimaryKey attribute is not part of EF Core.

Either this code block should be removed and only show the Fluent API code or there should be a note/comment added that PrimaryKey attribute is not part of EF Core and then a link to the correct package. (Tbh best solution i feel like is adding it to EF Core, but code first and only then documentation)


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@StijnOttenVMT StijnOttenVMT changed the title PrimaryKey(nameof() should be removed or a comment added It should be disclosed that PrimaryKey(nameof() is a EF Core #7 only attribute Nov 14, 2022
@StijnOttenVMT
Copy link
Author

Sorry was unaware this was part of the revision 7.0 update. But tbh things like ASP net core have revisions in their doc maybe EF Core should too

@roji
Copy link
Member

roji commented Nov 15, 2022

@StijnOttenVMT we've discussed this in the past, and decided that it's better to have a single version of the docs, and to call out in specific places where a new API was introduced, etc. I've submitted #4136 to do that here.

@roji roji self-assigned this Nov 15, 2022
@roji roji added this to the 7.0.0 milestone Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants