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

Multiple projects and migrations #43

Closed
rhires opened this issue Oct 10, 2015 · 5 comments
Closed

Multiple projects and migrations #43

rhires opened this issue Oct 10, 2015 · 5 comments

Comments

@rhires
Copy link
Contributor

rhires commented Oct 10, 2015

I seem to be in a bit of circular issue: I have a Web and a Business project. All my db access is in Business, and so when I'm in my Business directory, and run the command dnx ef migrations add FirstMigration, I get error messages complaining that "A type named 'StartupProduction' or 'Startup' could not be found in assembly Business" - but Startup wouldn't be here, it would be in the other directory/project. But if I do go into my Web project directory, I get different errors about there being no DbContext...

So is that right? Do I need a Startup.cs in my Business project? Or is there some kind of service I need to add (and more than a using statement that points to my Business project, since I have that) to the Startup.cs file?

PS Need to transfer this to the EF area, as it isn't really a documentation issue I have...

@smitpatel
Copy link
Member

dupe of dotnet/efcore#2679 ?

@rhires
Copy link
Contributor Author

rhires commented Oct 12, 2015

Yeah, I saw that one, but I wasn't sure if that was exactly the case, even if it's similar.

My first instinct is to just create a symlink to Startup.cs from the data access project to the project main, but that's just a hack. Instead, I began looking at the EF code, but then I wondered why it got ugly when @bricelam looked at, but then I realized I didn't understand nearly enough to even properly evaluate "ugly" so I stopped.

So thinking out loud here, if dnu/dnx knows that there is another project because it's listed in the dependencies, couldn't EF ask dnu/dnx about that? Or does dnu/dnx just keep that information to itself? Anyway, I love this stuff!

@bricelam
Copy link
Contributor

The Startup could not be found error should be resolved (in the nightly builds) by dotnet/efcore#3327.

We need dotnet/efcore#2679 to fully enable the scenario, and when it's in the commands would look something like this.

cd src\Business
dnx ef migrations add MyMigration --startupProject MyWebApplication

@smitpatel
Copy link
Member

We should have some documentation about how to get EF to work when start-up and context are in different projects.
Points to include:

  • How to set up startup
  • How to run ef commands

@rowanmiller rowanmiller removed this from the 1.0.0 milestone Jan 24, 2017
@natemcmaster natemcmaster mentioned this issue Feb 1, 2017
7 tasks
@rowanmiller
Copy link
Contributor

Consolidating with #204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants