1
如果我有我的域名實體User
具有財產代碼生成UpperEmail財產
public virtual string UpperEMail { get; protected set; }
,它是這樣映射
Property(x => x.UpperEmail, m =>
{
m.Length(150);
m.NotNullable(true);
m.UniqueKey("UniqueUpperEmail");
m.Access(Accessor.Field);
});
如何生成測試數據此UpperEmail屬性。
Account account = new Account()
{
Id = Guid.NewGuid(),
Email = "[email protected]",
UpperEmail = "[email protected]"
};
Ofcourse我收到以下錯誤(我不能設置值設置的原因訪問者是無法訪問)
非空屬性引用null或瞬時值 Account.UpperEmail
如何解決這個問題?