c# - How to enable Code First Entity Framework Migrations for Windows Azure when publishing from source control? -


i have project publishing azure automatically through source control. have configured azure have proper connection string entity framework context. need automatically run migrations against azure database associated website.

i know there option in publish dialog, need manually add whatever magic goes web.config tell azure apply migrations. required have azure run migrations source control , if not possible there way?

i using ef 6.

you need configure context migrate on run. need once per running process static constructor on context pretty decent place put it

static mycontext() {     database.setinitializer(new migratedatabasetolatestversion<mycontext, data.migrations.configuration>()); } 

also make sure connection string configured in azure.

if using automatic migrations (which bad idea in deployed site) need enabled


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -