Class PathExtractor
public static class PathExtractor
- Inheritance
-
PathExtractor
- Inherited Members
Methods
BuildQueryExpression(IEntityInfo, Guid, RelationshipPath)
Builds a synthetic include expression for a specific entity ID.
public static Expression BuildQueryExpression(IEntityInfo sourceMetadata, Guid sourceID, RelationshipPath includePath)
Parameters
sourceMetadataIEntityInfoMetadata for the main entity type
sourceIDGuidThe specific entity ID to filter by
includePathRelationshipPathThe relationship path to follow
Returns
BuildRelationshipExpression(Expression, RelationshipPath)
Builds Select/SelectMany expression chain for a relationship path.
public static Expression BuildRelationshipExpression(Expression sourceExpression, RelationshipPath relationshipPath)
Parameters
sourceExpressionExpressionBase query expression to build upon
relationshipPathRelationshipPathPath to traverse
Returns
- Expression
Expression with Select/SelectMany calls appended
ExtractRelationshipPath(LambdaExpression)
Extracts a RelationshipPath from a lambda expression supporting multi-level navigation. Examples: x => x.Enemy, x => x.Enemy.BestFriend, x => x.Enemy.BestFriend.Owns
public static RelationshipPath ExtractRelationshipPath(LambdaExpression selector)
Parameters
selectorLambdaExpression
Returns
TryExtractPropertyName(LambdaExpression, out string?)
Extracts a property name from a simple property access lambda expression. Example: x => x.Name -> "Name"
public static bool TryExtractPropertyName(LambdaExpression selector, out string? propertyName)
Parameters
selectorLambdaExpressionLambda expression accessing a single property
propertyNamestringProperty name
Returns
- bool
Whether a name could be extracted
TryExtractSelectManyRelationship(Expression, out RelationshipInfo?)
Extracts the relationship traversed by a SelectMany call in a query expression. Walks the expression tree to find the first SelectMany and extracts its relationship.
public static bool TryExtractSelectManyRelationship(Expression expression, out RelationshipInfo? relationship)
Parameters
expressionExpressionThe query expression to analyze
relationshipRelationshipInfoThe relationship traversed by SelectMany, if found
Returns
- bool
True if a SelectMany with a simple relationship property was found
Remarks
Only extracts simple SelectMany patterns: .SelectMany(x => x.Property) where Property
is a collection relationship directly on the parameter. Returns false for:
- Chained SelectMany calls (only the first is extracted)
- Nested property access:
.SelectMany(x => x.Owner.Dogs) - Complex expressions in the selector
- Non-relationship properties
Used by EntityCache to support synthetic include entries for SelectMany queries. When extraction fails, synthetic entries are gracefully skipped.