私のプロジェクトでは、MVC4 とエンティティを orm として使用する外部データベースを使用しています。
MVC によって提供されるメンバーシップを使用することにしたので、デフォルトでConnectionString
外部データベースを指すように変更しました。
次に、アプリを初めて起動したときに、いくつかのテーブルが追加されましたが、これまでのところ問題ありません。さて、問題は、新しく作成された userProfile テーブルを dataContext モデルにマップすると、競合が発生することです。このテーブルはすでに accountModel に存在するためです。
アカウント モデルと新しく生成されたモデルが同じ名前空間にあり、これを変更したくありません。どうすればよいですか?
これは、view add tables メソッドを使用して ADO エンティティ モデルによって生成されたクラスです。
public partial class UserProfile
{
public UserProfile()
{
this.Predictions = new HashSet<Prediction>();
}
public int UserId { get; set; }
public string UserName { get; set; }
public virtual ICollection<Prediction> Predictions { get; set; }
}
そしてここからメンバーシップ
[Table("UserProfile")]
public partial class UserProfile
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
}
どちらも同じ名前空間に存在し、競合しています。