Scaffolding Keyless Models on entity framework core 2.1

entity-framework-core entity-framework-core-2.1

Question

I have a simple console app and i am trying to scaffold all my models but i have some of them that does not have defined a primary key, Entity framework 2.1 give support to that kind of tables but still get this warning

Unable to identify the primary key for table 'dbo.myTable'.
Unable to generate entity type for table 'dbo.myTable'.

So then it doesn't generate the model

 dotnet ef dbcontext scaffold "Server=MyServer;Database=MyDb;Trusted_Connection=True;MultipleActiveResultSets=true" Microsoft.EntityFrameworkCore.SqlServer -o Models -f

Am I missing Any parameter or any help to scaffold models with no primary key defined?

1
2
6/14/2018 8:59:14 PM

Popular Answer

This was not possible until EF core 3.0 You can test it on Ef core 3.0 which is currently in preview.

1
7/5/2019 8:15:11 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow