Table of Contents

Class PathExtractor

Namespace
The.Linq
Assembly
Instagile.dll
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

sourceMetadata IEntityInfo

Metadata for the main entity type

sourceID Guid

The specific entity ID to filter by

includePath RelationshipPath

The relationship path to follow

Returns

Expression

BuildRelationshipExpression(Expression, RelationshipPath)

Builds Select/SelectMany expression chain for a relationship path.

public static Expression BuildRelationshipExpression(Expression sourceExpression, RelationshipPath relationshipPath)

Parameters

sourceExpression Expression

Base query expression to build upon

relationshipPath RelationshipPath

Path 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

selector LambdaExpression

Returns

RelationshipPath

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

selector LambdaExpression

Lambda expression accessing a single property

propertyName string

Property 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

expression Expression

The query expression to analyze

relationship RelationshipInfo

The 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.