static public PathBindingBuilder <TModel, TView, TModelValue> FromPath <TModel, TView, TModelValue>( this IPathBindingsProvider <TModel, TView> pathBindingsProvider, Expression <Func <TModel, TModelValue> > modelPropertyGetterExpression, Expression <Func <TModelValue, string> > modelPropertyPathGetter) { MemberExpression memberExpression = ExpressionUtils.GetPropertyMemberExpression(modelPropertyGetterExpression); string propertyName = memberExpression.Member.Name; InvocationExpression pathGetterBody = Expression.Invoke(modelPropertyPathGetter, modelPropertyGetterExpression.Body); Func <TModel, string> pathGetter = Expression.Lambda <Func <TModel, string> >(pathGetterBody, modelPropertyGetterExpression.Parameters).Compile(); Func <TModel, TModelValue> getter = modelPropertyGetterExpression.Compile(); return(new PathBindingBuilder <TModel, TView, TModelValue>(pathBindingsProvider.PathBindings, propertyName, (m, v) => getter(m), pathGetter)); }
static public PathBindingBuilder <TModel, TView, string> FromPath <TModel, TView>( this IPathBindingsProvider <TModel, TView> pathBindingsProvider, Expression <Func <TModel, string> > modelPropertyGetterExpression) { return(pathBindingsProvider.FromPath(modelPropertyGetterExpression, x => x)); }