-
-
Notifications
You must be signed in to change notification settings - Fork 159
Closed
Labels
Description
I found a bug when including nested reources. Consider the following example:
class Book {
// This is optional
[HasOne("Author")]
public virtual Author Author { get; set; }
}
class Author {
[HasMany("Image")]
public virtual IList<Image> Images { get; set; }
}
class Image {
}
Now when requesting Books with ?Include="Author.Images"
An exception is thrown from the ResourceGraph, when a book doesn't have an author. Because the parent entity is null.
JsonApiDotNetCore/src/JsonApiDotNetCore/Internal/ResourceGraph.cs
Lines 118 to 120 in 8570b21
public object GetRelationship<TParent>(TParent entity, string relationshipName) | |
{ | |
var parentEntityType = entity.GetType(); |