-
Notifications
You must be signed in to change notification settings - Fork 228
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
Entity classes for multiple schemas not separated into different folders #1914
Comments
This issue can be addressed by adding --schema [schema] and -o [output folder]. One would issue a dotnet ef command line for each schema. |
Duplicate of dotnet/efcore#3988 |
@kiberkli this would be an EF Core-level enhancement, and not specific to the PostgreSQL provider. You should probably take a look at the EF Core Power Tools, which supports this. |
@roji EF Core Power Tools does not support this. This is marked as enhancement in this issue. Today, it can create several folders, one per schema, but you can't set the namespace (one per schema) to fix the User1 problem. Do you have any suggestion? |
@guidevnet not really, unfortunately... |
I run the scaffolding command for each schema: Side effect is that it builds your project for each command. I have 11 schemas and I get a context class for each. I suppose it allows me to run it for only for the schema that changed. |
This is also my current way of doing things. However, this has several downsides:
This is very ugly, and I don't know if there is any optimization magic under the hood, it seems that it instantiate 15 Entity classes in every API request (and we have the need to be extremely responsive).
|
Hello all.
I'm migrating an existing postgresql database to be used with .Net Core. There are a number of schemas in the database.
I'm reverse engineering the database and I'm getting issues with the results. If there is a table in one schema and a table with the same name in a different schema, the entity classes that are create are Class.cs and Class1.cs in the output folder a specified (Entities):
These classes are in the same namespace and not differentiated in any meaningful way.
I haven't seen an scaffolding option that creates a subdirectory for each schema and places the schema's generated classes into that subdirectory:
Multiple dotnet commands for each schema would be nice, sort of like this:
dotnet ef \
dbcontext \
scaffold \
"Host=localhost;Database=my_database.my_admin;Username=dbuser;Password=dbpassword" Npgsql.EntityFrameworkCore.PostgreSQL \
--output-dir ./Entities/MyAdmin
dotnet ef \
dbcontext \
scaffold \
"Host=localhost;Database=my_database.client;Username=dbuser;Password=dbpassword" Npgsql.EntityFrameworkCore.PostgreSQL \
--output-dir ./Entities/Client
The classes would also have to be in a namespace for each schema.
(I'm sure I'm missing something, I can't be the only one who has multiple schemas.)
The text was updated successfully, but these errors were encountered: