我在1.0.0-rtm-21431版本上构建了asp.net核心应用程序,我更新到1.1.2并成功部署在azure上。
今天,我向模型中添加了新列。 Made" add-migration nameofmigration"和" update-database -verbose" 。在localhost上一切正常,但在azure我得到模型错误
public class Recipe
{
[Key]
public string Key { get; set; }
[DisplayName("Názov")]
public string Heading { get; set; }
[DisplayName("Kalórie")]
public int Cal { get; set; }
[DisplayName("Bielkoviny")]
public int Protein { get; set; }
}
迁移代码:
public partial class kcal : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Cal",
table: "Recipes",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Protein",
table: "Recipes",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Cal",
table: "Recipes");
migrationBuilder.DropColumn(
name: "Protein",
table: "Recipes");
}
}
=============================================== ============================
'Recipe' does not contain a definition for 'Cal' and no extension method 'Cal' accepting a first argument of type 'Recipe' could be found (are you missing a using directive or an assembly reference?)
+
#pragma warning restore 1998
'Recipe' does not contain a definition for 'Cal' and no extension method 'Cal' accepting a first argument of type 'Recipe' could be found (are you missing a using directive or an assembly reference?)
+
#pragma warning restore 1998
'Recipe' does not contain a definition for 'Cal' and no extension method 'Cal' accepting a first argument of type 'Recipe' could be found (are you missing a using directive or an assembly reference?)
+
#pragma warning restore 1998
'Recipe' does not contain a definition for 'Protein' and no extension method 'Protein' accepting a first argument of type 'Recipe' could be found (are you missing a using directive or an assembly reference?)
+
#pragma warning restore 1998
'Recipe' does not contain a definition for 'Protein' and no extension method 'Protein' accepting a first argument of type 'Recipe' could be found (are you missing a using directive or an assembly reference?)
localhost和deploy site使用SAME azure数据库
我是否错过了核心1.0.0 rtm和1.1.2之间的一些代码更改?