Exemple #1
0
        private IncludeExpression RewriteIncludeForSecondaryEndpoint(IncludeExpression relativeInclude, RelationshipAttribute secondaryRelationship)
        {
            IncludeElementExpression parentElement = relativeInclude != null
                ? new IncludeElementExpression(secondaryRelationship, relativeInclude.Elements)
                : new IncludeElementExpression(secondaryRelationship);

            return(new IncludeExpression(parentElement.AsArray()));
        }
Exemple #2
0
        private static IReadOnlyCollection <IncludeElementExpression> ApplyIncludeElementUpdates(IEnumerable <IncludeElementExpression> includeElements,
                                                                                                 IDictionary <IncludeElementExpression, IReadOnlyCollection <IncludeElementExpression> > updatesInChildren)
        {
            var newIncludeElements = includeElements.ToList();

            foreach (var(existingElement, updatedChildren) in updatesInChildren)
            {
                var existingIndex = newIncludeElements.IndexOf(existingElement);
                newIncludeElements[existingIndex] = new IncludeElementExpression(existingElement.Relationship, updatedChildren);
            }

            return(newIncludeElements);
        }