public IOperation Build()
            {
                Debug.Assert(_canBuild, ErrorMessages.InvalidOperation);
                var operation = new MergeableOperation <T>(_function, _new, _prev, _mergeJudge)
                {
                    Messaage = _name
                };

                return(_eventEventBinder.BindEvents(operation));
            }
예제 #2
0
        /// <summary>
        /// 2つのオペレーションをマージしたオペレーションを作成
        /// 失敗した場合はOperation.Emptyが返却される
        /// </summary>
        public static IOperation MakeMerged(MergeableOperation prevOperation, MergeableOperation postOperation, bool checkKey = true)
        {
            if (checkKey)
            {
                if (postOperation.MergeJudge.CanMerge(prevOperation.MergeJudge))
                {
                    return(new MergeableOperation(postOperation._rollForward, prevOperation._rollBack, postOperation.MergeJudge));
                }

                return(Operation.Empty);
            }
            return(new MergeableOperation(postOperation._rollForward, prevOperation._rollBack, postOperation.MergeJudge));
        }
 public MergeableBuilder(MergeableOperation operation) : base(operation)
 {
     _mergeableOperation = operation;
 }
예제 #4
0
 public static void Distinct <T>(this IOperationController controller, object key)
 {
     _distinct_internal <MergeableOperation <T> >(controller, key,
                                                  (x, y) => MergeableOperation <T> .MakeMerged(x, y, false));
 }