Device
主キーがシリアル番号 ala であるクラスがあります。
public class Device
{
/// <summary>
/// Device serial number
/// </summary>
[Key]
public int Serial { get; set; }
}
なんらかの理由で、このクラスを最初に作成するときに、実際には Entity Framework で主キーを設定できません。代わりに、独自の番号を作成しSerial
ます。私は何が欠けていますか?
context.Devices.AddOrUpdate(new Device()
{
Serial = 89484848 // never gets set, EF sets its own PK
});