Option to Generate DbContent and Entities in Different Locations
See original GitHub issueAs of v2.1 EF Core tooling has a --context-dir
option which allows generation of DbContext and Entities in different locations. It would be nice to have both --output-dir
and --context-dir
options via the UI for EFC PT.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Scaffold-DbContext to different output folder
I'm using Scaffold-DbContext setting my Backend Project as default project to destination of model classes, however DbContext Class is always ...
Read more >Migrations with Multiple Providers - EF Core
One way to create multiple migration sets is to use one DbContext type per provider. ... Specify the context type when adding new...
Read more >Best Practices in Using the DbContext in EF Core
A DbContext represents a collection of entity sets or tables in your database. It allows us to write strongly-typed code against our database ......
Read more >Generating a model from an existing database
You use the DbContext Scaffold command to generate the model. The command has two required arguments - a connection string and a provider....
Read more >Entity Framework Core DbContext
To use DbContext in our application, we need to create the class that derives from DbContext , also known as context class. This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I meant;
In project A, launch Power Tool, Rev Eng, select tables, select to only generate DbContext.
In project B, launch Power Tool, Rev Eng, select tables, select to only generate Entity Types.
Done
(I need the project reference, in particular for .NET Framework projects, in order to add the files.)
Yes, so instead of a single text box for “Project Path”, you would have two text boxes: “DbContext Path” and “Entities Path”. You would want to disable one or the other if they select the option to generate DbContext only or Entities only.
The user could specify just a folder name for either of these, which would indicate folders within the current project, for example, Context and Models.
Or the user could enter a relative path for the Entities Path, pointing to another project within the same solution, for example, …\MyApp.Entities. In that case, the DbContext Path would default to “.” for the local project. The beauty of this is that entities can be output to a NET Standard library, which can be referenced by a project that has repository interfaces and has no dependency on EF Core or any other persistence stack.
See this repo, which I repurposed to demonstrate the kind of project structure which separates entities from context.