-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
dbcontext scaffold - tables without primary key defined #5913
Comments
Currently it is not supported. We would be tackling the ability to scaffold something without a key as part of #1679 (I realize your scenario is a table without a key, but it would be covered by that feature). In the meantime, you would need exclude that table from the reverse engineer, and then manually add the entity and specify the properties that EF should use as the key. |
@hubert17 , you're wrong, it's August 2018 😂 |
So is there any solution for this problem? |
Yes, I was going to tackle #5719 at the same time. |
I'm facing the same issue, just got my project blocked due to this... |
Just need it to actually generate the model and throw a //TODO: in there indicating the need to define a key. I am fine with it throwing an error still if you try to use a class that doesn't define the key. But I am tired of hand creating models so I can manually define the key using attributes, it would be nice if the model existed so I could add the key attributes |
I agree! |
I'm really not looking forward to generating dozens of 50+ tables by hand, many of which do not have primary keys defined. :( |
What is the status of it? |
@sirobert It's closed. See comments above. |
And solution? I need scaffold model from database structure and tables has no primary keys. |
Up, same for me... |
Up, same for me.... |
Note, this issues was closed as a duplicate of #5719 |
You folks over at [redacted] should really focus more on your customers and their needs. Note: @ajcvickers edited this comment to remove content that violated the project’s code of conduct. |
How can we exclude the table from the reverse engineer? |
I tried to scaffold a dbcontext from a database from a 3th party vendor. Unfortunately the tables of this database have no primary key explicit defined. The scaffold command fails with:
Unable to identify the primary key for table 'abc'.
Unable to generate entity type for table 'abc'.
In the past we have connected to the database with edmx data-model and there was no problem. Is it possible to scaffold without primary key or to set a option on the command wich defines the primary key field?
The text was updated successfully, but these errors were encountered: