public static IBindingToSyntax <TTarget, TSource> Bind <TTarget, TSource>([NotNull] this IBindingBuilder builder, [NotNull] TTarget targetGeneric, [NotNull] string targetPath) where TTarget : class { Should.NotBeNull(builder, "builder"); Should.NotBeNull(targetGeneric, "targetGeneric"); Should.NotBeNullOrWhitespace(targetPath, "targetPath"); builder.Add(BindingBuilderConstants.Target, targetGeneric); builder.Add(BindingBuilderConstants.TargetPath, BindingServiceProvider.BindingPathFactory(targetPath)); return(new SyntaxBuilder <TTarget, TSource>(builder)); }
public static IBindingToSyntax Bind([NotNull] this IBindingBuilder builder, [NotNull] object target, [NotNull] string targetPath) { Should.NotBeNull(builder, "builder"); Should.NotBeNull(target, "target"); Should.NotBeNullOrWhitespace(targetPath, "targetPath"); builder.Add(BindingBuilderConstants.Target, target); builder.Add(BindingBuilderConstants.TargetPath, BindingPath.Create(targetPath)); return(builder.GetOrAddSyntaxBuilder()); }
private static SyntaxBuilder <object, object> GetOrAddSyntaxBuilder(this IBindingBuilder builder) { SyntaxBuilder <object, object> syntaxBuilder; if (!builder.TryGetData(SyntaxBuilderConstant, out syntaxBuilder)) { syntaxBuilder = new SyntaxBuilder <object, object>(builder); builder.Add(SyntaxBuilderConstant, syntaxBuilder); } return(syntaxBuilder); }
protected virtual void BuildParameterFromLambdaExpressionInternal <TValue>(IBindingBuilder builder, Func <LambdaExpression> expression, DataConstant <Func <IDataContext, TValue> > parameterConstant) { Func <IDataContext, TValue> value; var func = LambdaExpressionToBindingExpressionConverter.ConvertParameter(builder, expression); if (typeof(TValue) == typeof(object)) { value = (Func <IDataContext, TValue>)(object) func; } else { value = func.CastFunc <TValue>; } builder.Add(parameterConstant, value); }