Class ExpressionHelper
Inheritance
Inherited Members
Namespace: EPiServer.Commerce
Assembly: EPiServer.Business.Commerce.dll
Version: 13.30.0Syntax
public class ExpressionHelper
Constructors
ExpressionHelper()
Declaration
public ExpressionHelper()
Methods
GetExpressionPath(Expression)
Gets a string representation of the member expressions in an expressions body possibly containing multiple levels. Example: Type A has a property TheB of type B which has a property TheC of any type. Calling this method with the body of the expression a => a.TheB.TheC returns {"TheB", "TheC"}.
Declaration
protected virtual IEnumerable<string> GetExpressionPath(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | The expression body to get the path for. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The full property path. |
GetExpressionPath<T>(Expression<Func<T, Object>>)
Gets a string representation of the member expressions in an expressions body possibly containing multiple levels. Example: Type A has a property TheB of type B which has a property TheC of any type. GetFullPropertyName<A>(a => a.TheB.TheC) returns {"TheB", "TheC"}.
Declaration
public virtual IEnumerable<string> GetExpressionPath<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, System.Object>> | expression | The expression of the property to get the path for. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The full property path. |
Type Parameters
Name | Description |
---|---|
T | The type to get a property name for. |
GetFullPropertyName<T>(Expression<Func<T, Object>>)
Gets a string representation of the member expressions in an expressions body possibly containing multiple levels. Example: Type A has a property TheB of type B which has a property TheC of any type. GetFullPropertyName<A>(a => a.TheB.TheC) returns "TheBTheC".
Declaration
public virtual string GetFullPropertyName<T>(Expression<Func<T, object>> expression)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, System.Object>> | expression | The expression of the property name to get. |
Returns
Type | Description |
---|---|
System.String | The full property path. |
Type Parameters
Name | Description |
---|---|
T | The type to get a property name for. |
GetFullPropertyName<T>(Expression<Func<T, Object>>, String)
Gets a string representation of the member expressions in an expressions body possibly containing multiple levels. Example: Type A has a property TheB of type B which has a property TheC of any type. GetFullPropertyName<A>(a => a.TheB.TheC) returns "TheBTheC".
Declaration
public virtual string GetFullPropertyName<T>(Expression<Func<T, object>> expression, string separator)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<T, System.Object>> | expression | The expression of the property name to get. |
System.String | separator | Optional separator between levels, defaults to no separator. |
Returns
Type | Description |
---|---|
System.String | The full property path. |
Type Parameters
Name | Description |
---|---|
T | The type to get a property name for. |