/// <summary> /// replaces the keys of the <paramref name="entitiesByRelationship"/> dictionary /// with its inverse relationship attribute. /// </summary> /// <param name="entitiesByRelationship">Entities grouped by relationship attribute</param> private Dictionary <RelationshipAttribute, IEnumerable> ReplaceKeysWithInverseRelationships(Dictionary <RelationshipAttribute, IEnumerable> entitiesByRelationship) { // when Article has one Owner (HasOneAttribute:owner) is set, there is no guarantee // that the inverse attribute was also set (Owner has one Article: HasOneAttr:article). // If it isn't, JADNC currently knows nothing about this relationship pointing back, and it // currently cannot fire hooks for entities resolved through inverse relationships. var inversableRelationshipAttributes = entitiesByRelationship.Where(kvp => kvp.Key.InverseNavigation != null); return(inversableRelationshipAttributes.ToDictionary(kvp => _resourceGraph.GetInverse(kvp.Key), kvp => kvp.Value)); }