azure - Publish Entity-Framework Code-First Migrations with no Context in the startup project -
i building solution following projects:
main.data- class library projectmain.api- asp.net mvc webapi - references main.datamain- asp.net mvc 4 web application - references main.api
i have mycontext : dbcontext class located inside main.data project. have issues enable-migrationsconsole command on main.data project, , using localdb sql server data , upgrade-database migrations.
the problem starts when trying publish main project windows azure website.
the publish profile automatically created using import windows azure web site not seems recognize using entity framework code first solution, , can't enable execute code first migrations to.
instead, can enable update database scripts.
i using visual studio 2012 entity framework 5.0.0 (since beginning of project).
just verify, have tried add temporary mycontext class inside main project , enable-migrations on main project, , after publish profile automatically detected entity framework code-first.
is, of-course, not solution (or it?)
here relevant threads:
- this base learning tutorial.
- this explains deployment options, no troubleshooting.
- this gives few ideas try, seems unnatural.
i looking clean stable solution. have put context class inside main project?
thanks in advance
i can enable execute code first migrations when create publish profile.
here did achieve it:
- inside
main/web.configchanged name of connection string fqn of context class:main.data.mycontext. - add reference
mainprojectmain.dataproject (which not needed until now).
this job me.
if got better or more educating answer, happy hear it.
Comments
Post a Comment