azure - Publish Entity-Framework Code-First Migrations with no Context in the startup project -


i building solution following projects:

  • main.data - class library project
  • main.api - asp.net mvc webapi - references main.data
  • main - 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:

  1. inside main/web.config changed name of connection string fqn of context class: main.data.mycontext.
  2. add reference main project main.data project (which not needed until now).

this job me.
if got better or more educating answer, happy hear it.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -