Open voroninp opened 3 hours ago
Phew. This is NOT what EF Core Power Tools were designed for 😅
Despite being asked when creating the issue you are not giving any details about EF Core version or provider.. so I am guessing!
Would something like this work?
Yes, this can do the trick =) I'll try, thanks.
details about EF Core version or provider
Hm... will different models be generated based on provider?
.dacpac is only available for SQL Server/Azure SQL
For item 1 you can use the EF Core CLI
For item 2 you can use sqlpackage
For item 3 you can use EF Core Power Tools CLI
Ah, we use Postgres
That's exactly why this information matters. In that case you need to use the create script to publish the schema to a database
When doing DDD one usually encapsulates aggregate's state and exposes behavior via aggregate root. Domain Models are used in command/write flow where aggregate is usually fetched by id. No extensive querying capabilities are required for this flow. However, for read flow it's better to have plain DTOs with navigation properties for the convenience of building queries using includes and projections.
So, I need to generate the second query-oriented DbContext based on the model defined in write-oriented DbContext. It's like poor man's CQRS where on database level read model is equivalent to write model. Currently, this can be achieved by creating a database using migrations of write-oriented DbContext and then reverse engineering the database back. But I wish I could omit this intermediary step.
Effectively, I want to automate the flow shown in Milan's video https://www.youtube.com/watch?v=iKDITShiZy4