You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
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!
Activity
smitpatel commentedon Oct 12, 2015
dupe of dotnet/efcore#2679 ?
rhires commentedon 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 commentedon Oct 13, 2015
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 MyWebApplicationsmitpatel commentedon Dec 8, 2015
We should have some documentation about how to get EF to work when start-up and context are in different projects.
Points to include:
rowanmiller commentedon Feb 1, 2017
Consolidating with #204