entity-framework-4.2

Difference between DbSet.Remove and DbContext.Entry(entity).State = EntityState.Deleted

烈酒焚心 提交于 2019-12-01 03:26:48
Consider the following entity model: public class Agreement : Entity { public int AgreementId { get; set; } public virtual ICollection<Participant> Participants { get; set; } } public class Establishment : Entity { public int EstablishmentId { get; set; } } public class Participant : Entity { public int AgreementId { get; set; } public virtual Agreement Agreement { get; set; } public int EstablishmentId { get; set; } public virtual Establishment { get; set; } public bool IsOwner { get; set; } } The reason there is not a direct ICollection<Establishment> on the Agreement entity is because of

Difference between DbSet.Remove and DbContext.Entry(entity).State = EntityState.Deleted

被刻印的时光 ゝ 提交于 2019-12-01 00:06:43
问题 Consider the following entity model: public class Agreement : Entity { public int AgreementId { get; set; } public virtual ICollection<Participant> Participants { get; set; } } public class Establishment : Entity { public int EstablishmentId { get; set; } } public class Participant : Entity { public int AgreementId { get; set; } public virtual Agreement Agreement { get; set; } public int EstablishmentId { get; set; } public virtual Establishment { get; set; } public bool IsOwner { get; set; }