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