Dotnet EntityFrameworkCore Scaffolding with multiple schemas

Viewed 1574

I am trying to use the the "dotnet ef dbcontext scaffold" command to generate the a model of our database, which has multiple schemas that have the same name. For example, there would be Import.Person and Core.Person and the table structures are not the same. On my first go around, it generated the models with Person and the Person1, which is incredibly unhelpful. So, I was trying to get it to scaffold each schema into a different folder like so:

dotnet ef dbcontext scaffold "connectionString" Microsoft.EntityFrameworkCore.SqlServer --schema Import -o Models\Import

The problem that I then run into is that I receive the warning "Could not scaffold the foreign key '[KeyName]'. The referenced table could not be found. This most likely occured because the referenced table was excluded from scaffolding.

Ideally it would be awesome to have something like Models.Import.Person and Models.Core.Person.

So, my question is: Is there some way to automatically scaffold the database but have readable class names, like mentioned above or similar?

0 Answers
Related