执行code首先迁移在发布设置变灰出 [英] Execute Code First Migrations is Grayed Out in Publish Settings

查看:80
本文介绍了执行code首先迁移在发布设置变灰出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Windows Azure和尝试发布我MVC3应用。在发布Web应用程序的设置面板中执行code首先迁移的复选框显示为灰色。什么样的变化,我需要做出能够启用呢?

Using Windows Azure and attempting to publish my MVC3 Application. The check box for Execute Code First Migration in the settings panel of the Publish web application is grayed out. What changes do I need to make to be able to enable it?

推荐答案

我相信你看到下面的执行code首先迁移已禁用当您尝试发布您的MVC应用程序:

I believe you see the following "Execute Code First Migration" disabled when you try to publish your MVC application:

这可能是因为无论你做你的应用程序code写的迁移,以及未满code无或描述的这里

This is potentially because either you do not full code written for Code migration in your application as well no or incorrect DB setup in your web.config as described here.

为了让code启用迁移,你必须有一个DB配置(在Windows Azure中的情况下,你需要提供在web.config中的SQL数据库信息)在web.config中和一个完整的类写在如何code迁移将发生取决于你的模型。 这里是如何实现它的一个例子。

In order to have Code Migration enabled, you must have a DB configured (in case of Windows Azure you need to provide SQL Database info in the web.config) in web.config and a complete class is written on how the code migration will happen depend on your model. Here is an example on how to achieve it.

<一个href=\"http://msdn.microsoft.com/en-us/library/dd394698#efcfmigrations\">http://msdn.microsoft.com/en-us/library/dd394698#efcfmigrations

这篇关于执行code首先迁移在发布设置变灰出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆