Esempio n. 1
0
        public SynchronizationMultipleDependency(SynchronizationRule <TLeft, TRight> parentRule, SynchronizationRule <TDepLeft, TDepRight> childRule, Expression <Func <TLeft, ICollectionExpression <TDepLeft> > > leftSelector, Expression <Func <TRight, ICollectionExpression <TDepRight> > > rightSelector)
        {
            if (parentRule == null)
            {
                throw new ArgumentNullException("parentRule");
            }
            if (childRule == null)
            {
                throw new ArgumentNullException("childRule");
            }
            if (leftSelector == null)
            {
                throw new ArgumentNullException("leftSelector");
            }
            if (rightSelector == null)
            {
                throw new ArgumentNullException("rightSelector");
            }

            this.parentRule = parentRule;
            this.childRule  = childRule;

            this.__leftGetter  = ExpressionCompileRewriter.Compile(leftSelector);
            this.__rightGetter = ExpressionCompileRewriter.Compile(rightSelector);
        }
Esempio n. 2
0
        public OneWaySynchronizationMultipleDependency(TransformationRuleBase <TSource, TTarget> parentRule, TransformationRuleBase <TSourceDep, TTargetDep> childRule, Expression <Func <TSource, IEnumerableExpression <TSourceDep> > > leftSelector, Expression <Func <TTarget, ICollection <TTargetDep> > > rightSelector)
        {
            if (parentRule == null)
            {
                throw new ArgumentNullException("parentRule");
            }
            if (childRule == null)
            {
                throw new ArgumentNullException("childRule");
            }
            if (leftSelector == null)
            {
                throw new ArgumentNullException("leftSelector");
            }
            if (rightSelector == null)
            {
                throw new ArgumentNullException("rightSelector");
            }

            this.parentRule = parentRule;
            this.childRule  = childRule;

            this.__sourceGetter = ExpressionCompileRewriter.Compile(leftSelector);
            this.__targetGetter = ExpressionCompileRewriter.Compile(rightSelector);
        }
        public SynchronizationSingleDependency(SynchronizationRule <TLeft, TRight> parentRule, SynchronizationRule <TDepLeft, TDepRight> childRule, Expression <Func <TLeft, TDepLeft> > leftSelector, Expression <Func <TRight, TDepRight> > rightSelector, Action <TLeft, TDepLeft> leftSetter, Action <TRight, TDepRight> rightSetter)
        {
            if (parentRule == null)
            {
                throw new ArgumentNullException("parentRule");
            }
            if (childRule == null)
            {
                throw new ArgumentNullException("childRule");
            }
            if (leftSelector == null)
            {
                throw new ArgumentNullException("leftSelector");
            }
            if (rightSelector == null)
            {
                throw new ArgumentNullException("rightSelector");
            }

            this.parentRule = parentRule;
            this.childRule  = childRule;

            this.leftGetter  = ExpressionCompileRewriter.Compile(leftSelector);
            this.rightGetter = ExpressionCompileRewriter.Compile(rightSelector);
            if (leftSetter == null)
            {
                var leftSetterExp = SetExpressionRewriter.CreateSetter(leftSelector);
                if (leftSetterExp != null)
                {
                    this.leftSetter = ExpressionCompileRewriter.Compile(leftSetterExp);
                }
                this.leftFunc = Observable.Func(leftSelector);
            }
            else
            {
                this.leftSetter = leftSetter;
                this.leftFunc   = Observable.Func(leftSelector, leftSetter);
            }
            if (rightSetter == null)
            {
                var rightSetterExp = SetExpressionRewriter.CreateSetter(rightSelector);
                if (rightSetterExp != null)
                {
                    this.rightSetter = ExpressionCompileRewriter.Compile(rightSetterExp);
                }
                this.rightFunc = Observable.Func(rightSelector);
            }
            else
            {
                this.rightSetter = rightSetter;
                this.rightFunc   = Observable.Func(rightSelector, rightSetter);
            }
        }