私はEF5.xコードファーストを使用しています
namespace DAO.Models
{
public partial class Person
{
public int UserId { get; set; }
}
}
カスタムプロパティを追加するために、別の部分クラスを作成しました。
namespace DAO.Models
{
public partial class Person
{
public string customName { get; set; }
}
}
EF5.xパワーツールによって生成されたマッピングがあります
public PersonMap()
{
// Primary Key
this.HasKey(t => new { t.PersonId });
// Table & Column Mappings
this.ToTable("Person", "TableX");
this.Property(t => t.PersonId).HasColumnName("PersonId");
}
新しい人をdbに追加しようとすると
XContext db = new XContext();
Person per= new Person();
db.Persons.Add(per);
フィールドリストエラーで不明な列customNameを取得します