Skip to content
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

Support scaffolding models and context to separate projects (for update from database) #7847

Open
Tracked by #22948
danobri opened this issue Mar 10, 2017 · 12 comments

Comments

@danobri
Copy link

danobri commented Mar 10, 2017

In addition to supporting "update model from database" (issue #831), it would be great if Scaffold-DbContext supported generating the context and models in separate projects, given that it is common practice. In fact, that is exactly what Julie Lerman does in her Pluralsight course on EF Core. When she demos the code first approach, she creates two projects - Domain (for her models) and Data (for her DbContext and migrations). But when she demos scaffolding from an existing database, she has to dump everything in one folder in one project. I am really excited about EF Core for many reasons, but would really like to see the Database First approach continue to be fully supported, regardless of whether there is a visual editor. Seems like it's inline with the current direction at Microsoft to give developers freedom to choose their language/platform of choice.

@bricelam
Copy link
Contributor

bricelam commented Mar 10, 2017

I'd ask: Is it easier to drag and drop the DbContext class into the Data project after generation, or to type the path the the Data project on the command line using some obscure parameter that you would have to learn about before using?

@bricelam
Copy link
Contributor

But making update model from database work when your DbContext and entity type classes are in separate projects is an interesting scenario to consider.

@danobri
Copy link
Author

danobri commented Mar 10, 2017

Exactly - was just typing a response to that effect. The update process will obviously need to know where the existing DbContext class lives.

@danobri
Copy link
Author

danobri commented Mar 10, 2017

Previously I accomplished this with the "DbContext Generator" T4 templates. Originally they were 3rd party extensions, but eventually they got included in Visual Studio starting with VS2013. https://msdn.microsoft.com/en-us/library/jj613116(v=vs.113).aspx

@ajcvickers
Copy link
Member

This makes sense for update from database, so putting on the backlog for that.

@ajcvickers ajcvickers added this to the Backlog milestone Mar 13, 2017
@bricelam
Copy link
Contributor

bricelam commented Jun 8, 2017

The original request is a dupe of #1836, but I think this one evolved enough to be tracked separately.

@ErikEJ
Copy link
Contributor

ErikEJ commented Dec 8, 2019

EF Core Power Tools now gives you full control of folder paths.

@userasad
Copy link

ER Core Power Tools helped me to achieve the same scenario.

@sameer-kumar
Copy link

sameer-kumar commented Sep 22, 2021

I could never make EF Core Power Tools to work in my setup of VS2019 and EFCore3.1. That's why I like this to see it in OOB EF scaffolding instead of relying on 3rd party products.

@ErikEJ
Copy link
Contributor

ErikEJ commented Sep 22, 2021

@sameer-kumar Feel free to open an issue in the EF Core Power Tools repo, and I can assist in making the tool work for you

@ajcvickers
Copy link
Member

@sameer-kumar The Power Tools are high quality and very reliable. We recommend them. Definitely engage with Erik if you're having issues.

@sameer-kumar
Copy link

Thanks. Will give another try and share my experiences soon.

@bricelam bricelam changed the title Support scaffolding models and context to separate projects Support scaffolding models and context to separate projects (for update from database) Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants