Closed Kizzik closed 2 years ago
Consider the solution to issue #102.
If your case is different then you'd want to create a sample we can execute and reproduce the problem (zip upload, a new repository, or add to one of the tests).
That sorted out the issue, thanks heaps for that! So is that to say without this option enabled, for a recursive relationship we can only go down the chain (entity > children), not back up it?
That sorted out the issue, thanks heaps for that! So is that to say without this option enabled, for a recursive relationship we can only go down the chain (entity > children), not back up it?
Not sure about that - I would have thought it would fail in either direction if it's already in the hierarchy. That logic is in the main AutoMapper repository.
Consider the following entity:
And corresponding DTO:
With a mapping of:
CreateMap<TBuildingType, BuildingType>();
When I retrieve the entities, I'm able to expand the children just fine, however when I try to expand the parent it always returns null (even when the entity has a valid parent ID). The following SQL is generated for the call when expanding parent:
Where, if I'm reading it correctly, [o] is the child and [o0] is the parent. It appears to have the joined Id/ParentId relationship reversed. If I manually execute the query with those properties reversed ([o0].[Id] = [o].[ParentId]) it shows the result set I would expect to see in SQL.
If I run the same query options directly against the entity it works as I'd expect. If there's something that I've done wrong in the entity setup or mapping please let me know, but it appears to me that this is happening somewhere in GetQueryAsync.