Entity Framework will only set related entity property to “null” if I first get the property
- 阅读更多 关于 Entity Framework will only set related entity property to “null” if I first get the property
问题 Edit This seems to occur for any Entity property that references another entity in one direction. In other words, for the below example, the fact that Bar overrides Equality appears to be irrelevant. Suppose I have the following classes: public class Foo { public int? Id { get; set; } public virtual Bar { get; set; } } public class Bar : IEquatable<Bar> { public int Id { get; set; } public override bool Equals(object obj) { var other = obj as Bar; return Equals(other); } public bool Equals