EntityFrameworkCore icon indicating copy to clipboard operation
EntityFrameworkCore copied to clipboard

self refrence still can not work

Open SarcoZ opened this issue 7 years ago • 1 comments

public class Area { [BsonId] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public ObjectId Id { get; private set; } public string Name { get; set; } public string Code { get; set; }
public virtual Area Parent { get; set; }
public virtual ICollection<Area> Areas { get; set; } }

my class is area ,has child ICollection<Area> Areas,which is self refrence, save can success,but can not read,use include still not work

SarcoZ avatar Dec 11 '18 10:12 SarcoZ

I am currently working on this issue. It appears to be a problem with ForeignKey.IsSelfPrimaryReferencingKey() returning true, causing certain checks that try to map between ForeignKey.PrincipalToDependent and ForeignKey.DependentToPrincipal to incorrectly switch contexts. There seems to be a related piece of EF Core that I have yet to override that will fix it completely.

crhairr avatar Dec 16 '18 06:12 crhairr