1
私はIDBSetエンティティでEFを使用していますが、プロパティにはPKとしてGUIDがありますが、エンティティの1つが自動インクリメントを所有している必要があります。自動増分プロパティである必要があるプロパティにキー属性を設定すると、GUID PKでなくなります。EFでの非PKプロパティのアイデンティティ
誰でも、自動インクリメントのプロパティをPKでオンにしないでEFに挿入する方法はわかりますか?
namespace Service.Entity.Order
{
[Serializable]
public class Order : IEntity
{
#region Properties
public Guid Id { get; set; }
public DateTime DateImplementation { get; set; }
public DateTime? DateDelivery { get; set; }
//Field Auto-Increment
public int NrOrder { get; set; }
#endregion
#region Status
public int ProcessStatus { get; set; }
public Status Created { get; set; }
public Status Approved { get; set; }
public Status PolicyDefined { get; set; }
#endregion
#region RelationShips
public Client Client { get; set; }
public User User { get; set; }
public Representation Representation { get; set; }
public Contact Contact { get; set; }
#endregion
}
}
はこのヘルプをしていますか? http://stackoverflow.com/questions/6585455/entity-framework-4-1-code-first-auto-increment-field-on-insert-for-non-primary –