BlueshiftSoftware / EntityFrameworkCore

NoSQL providers for EntityFramework Core
Other
281 stars 57 forks source link

self refrence still can not work #34

Open SarcoZ opened 5 years ago

SarcoZ commented 5 years ago

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 Areas { get; set; } }

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

crhairr commented 5 years ago

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.