我有一个问题:如何使用 EF 添加已存在于数据库中的表?
public DbSet<webpages_Membership> webpages_Memberships { get; set; }
和型号:
[Table("webpages_Membership")]
public class webpages_Membership
{
[Key]
public int UserId { get; set; }
public DateTime CreateDate { get; set; }
public string ConfirmationToken { get; set; }
public bool IsConfirmed { get; set; }
public DateTime LastPasswordFailureDate { get; set; }
public int PasswordFailuresSinceLastSuccess { get; set; }
public string Password { get; set; }
public DateTime PasswordChangeDate { get; set; }
public string PasswordSalt { get; set; }
public string PasswordVerificationToken { get; set; }
public DateTime PasswordVerificationTokenExpirationDate { get; set; }
}
问题是 - 当我尝试时update-database
,它会创建新表dbo.webpages_Membership
(带有前缀 dbo),但我想使用的表女巫是my_project.webpages_Membership
.
我该如何解决?