Table of Contents

Class PropertySignature

Namespace
Breeze.Core
Assembly
Breeze.Core.dll

A property path such as "Customer.Address.City", resolved against a starting type into the chain of PropertyInfo it names, and buildable into the LINQ expression that reads it.

public class PropertySignature
Inheritance
PropertySignature
Inherited Members

Remarks

Query clauses - where, orderBy, select, expand - all address properties by path, so each of them resolves its paths through this class. Resolution happens in the constructor, so an instance that was constructed successfully always holds a valid chain.

Constructors

PropertySignature(Type, string)

Resolve a property path against a type.

public PropertySignature(Type instanceType, string propertyPath)

Parameters

instanceType Type

The type the path starts from.

propertyPath string

A property name, or several joined with '.' to walk into related types.

Exceptions

Exception

A segment of the path does not name a public instance property or field of the type it is applied to.

Properties

ElementType

For a path ending in a collection, the type of its items; null for a scalar property.

public Type? ElementType { get; }

Property Value

Type

InstanceType

The type the path starts from.

public Type InstanceType { get; }

Property Value

Type

IsDataProperty

Whether the path ends in a value - a predefined type or an enum - rather than in another entity.

public bool IsDataProperty { get; }

Property Value

bool

IsNavigationProperty

Whether the path ends in another entity, or a collection of them, rather than in a value.

public bool IsNavigationProperty { get; }

Property Value

bool

Name

The path with its segments joined by '_', giving a name usable as an identifier - "Customer_Address_City".

public string Name { get; }

Property Value

string

Properties

The resolved chain, one entry per segment of the path.

public List<PropertyInfo> Properties { get; }

Property Value

List<PropertyInfo>

PropertyPath

The path as it was written, e.g. "Customer.Address.City".

public string PropertyPath { get; }

Property Value

string

ReturnType

The type of the last property in the chain - what reading the path yields.

public Type ReturnType { get; }

Property Value

Type

Methods

BuildMemberExpression(ParameterExpression)

Build the expression that reads this path off a parameter - for the path "Address.City" and parameter x, the expression x.Address.City.

public Expression BuildMemberExpression(ParameterExpression parmExpr)

Parameters

parmExpr ParameterExpression

The parameter the path is read from, typically the lambda parameter of the query.

Returns

Expression

The member access expression.

BuildPropertyExpression(Expression, PropertyInfo)

Build a single property access - one step of the chain that BuildMemberExpression(ParameterExpression) assembles.

public Expression BuildPropertyExpression(Expression baseExpr, PropertyInfo property)

Parameters

baseExpr Expression

The expression the property is read from.

property PropertyInfo

The property to read.

Returns

Expression

The member access expression.

GetProperties(Type, string, bool)

Walk a property path, yielding the property behind each segment.

public static IEnumerable<PropertyInfo> GetProperties(Type instanceType, string propertyPath, bool throwOnError = true)

Parameters

instanceType Type

The type the path starts from.

propertyPath string

A property name, or several joined with '.'.

throwOnError bool

When true an unresolvable segment throws; when false the walk stops there, yielding only the segments that did resolve.

Returns

IEnumerable<PropertyInfo>

The properties named by the path, in order.

Exceptions

Exception

A segment does not resolve and throwOnError is true.

IsProperty(Type, string)

Whether a property path resolves against a type, without throwing if it does not.

public static bool IsProperty(Type instanceType, string propertyPath)

Parameters

instanceType Type

The type the path starts from.

propertyPath string

The path to test.

Returns

bool

True if the path resolves.