【发布时间】:2016-11-13 06:49:04
【问题描述】:
我的代码是这样的
public class Address
{
public int Id { get; set; }
public string City { get; set; }
public int PostNo { get; set; }
public string Street { get; set; }
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
public System.Data.Entity.DbSet<MearnIt.Models.Address> Addresses { get; set; }
}
当我在 nuget 包管理器控制台上运行 Update-Database 命令时,它会抛出此错误。
Cannot find the object "dbo.Addresses" because it does not exist or you do not have permissions.
我不知道为什么会抛出这样的错误。谁能指出这里出了什么问题?
【问题讨论】:
-
异常告诉你检查两件事。首先在迁移连接到的数据库上执行此操作。
标签: asp.net-mvc entity-framework nuget-package