Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Recognize "Id" as primary key on import #19

Closed
JorgenLindell opened this issue Aug 29, 2018 · 4 comments
Closed

Recognize "Id" as primary key on import #19

JorgenLindell opened this issue Aug 29, 2018 · 4 comments
Labels
enhancement New feature request released Issue is resolved in a current release

Comments

@JorgenLindell
Copy link

I started trying this out today by importing a set of EF Core classes.

One thing that I had to do was to go through 50+ classes and mark the Id field as primary key.
EF Core automagically recognizes Id as being the primary key, so that doesn't need to be tagged by an attribute.
It would be practical if you could set an option to make EFDesigner do the same.

@msawczyn msawczyn added the enhancement New feature request label Aug 29, 2018
@msawczyn
Copy link
Owner

That's an excellent idea.

To clarify, you're talking about drag/drop import of code onto the design surface, yes? The tool would, if it sees a property named Id, tag that property as an identity property when it imports the dropped class. Do I have that right?

@JorgenLindell
Copy link
Author

JorgenLindell commented Aug 29, 2018

Yes, but probably only if no other key is set to be key

The convention is defined in https://docs.microsoft.com/en-us/ef/core/modeling/keys
as "By convention, a property named Id or <type name>Id will be configured as the key of an entity."

@msawczyn
Copy link
Owner

Yes, should have said that. Would be quite rude to step on user-defined identity properties :-)

Thanks for the suggestion. I've got that going into the next release.

@msawczyn
Copy link
Owner

Had a moment so pushed the change out. It's in v1.2.5.

@msawczyn msawczyn added the released Issue is resolved in a current release label Nov 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature request released Issue is resolved in a current release
Projects
None yet
Development

No branches or pull requests

2 participants