-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query: ThenInclude throw ArgumentNullException when entity implements the interface #3409
Comments
This is because mapping to interfaces is not supported. This means Enabling this scenario with interfaces is already tracked by #757 |
I may be missing something but it seems that this could be just a bug in
using (var context = new TestContext22())
{
context.Entity1.Load();
context.Entity2.Load();
}
using (var context = new TestContext22())
{
context.Entity1.Include(p => p.EntityChilds).Load();
}
using (var context = new TestContext22())
{
context.Entity2.Include(p => p.Parent).Load();
}
using (var context = new TestContext22())
{
context.Entity2.Include(p => p.ParentRef).Load();
}
using (var context = new TestContext22())
{
context.Entity2.Include(p => p.Childs).Load();
}
using (var context = new TestContext22())
{
context.Entity2.Include(p => p.Parent).Include(p => p.ParentRef).Load();
} These two cases fail with ArgumentException: using (var context = new TestContext22())
{
context.Entity1.Include(p => p.EntityChilds).ThenInclude(i => i.Childs).Load();
}
using (var context = new TestContext22())
{
context.Entity2.Include(p => p.Parent).ThenInclude(i => i.ParentRef).Load();
} (Note: I tried all this with beta8) |
In intellisence after i expand Entity1 and Entity2 and then expand context.Entity1.EntityChilds.Childs - all is good. Simple include with public virtual ICollection EntityChilds { get; set; } work fine with interfaces. |
Ran the original reproduction and the additional cases mentioned by @divega and they are all executing without throwing. There have been several changes to Include since this issue was filed, and it is likely one of these changes also resolved this issue. |
@mikary do we have any test that looks like this scenario? we shouldn't regress it... |
}
The text was updated successfully, but these errors were encountered: