Beispiel #1
0
        private bool ResolveProductConflict(ObjectChangeConflict conflict)
        {
            Product current = (Product)conflict.Object;

            if (conflict.IsDeleted)
            {
                // we don't attempt to resolve delete conflicts -
                // we send those back to the client
                return(false);
            }

            switch (current.ResolveMethod)
            {
            case "ThrowValidationEx":
                throw new ValidationException("testing");

            case "ThrowDomainServiceEx":
                throw new DomainException("testing");

            case "MergeIntoCurrent":
                conflict.Resolve(RefreshMode.KeepChanges);
                break;

            case "KeepCurrent":
                conflict.Resolve(RefreshMode.KeepCurrentValues);
                break;

            case "RefreshCurrent":
                conflict.Resolve(RefreshMode.OverwriteCurrentValues);
                break;

            case "ReturnTrueNoResolve":
                return(true);

            case "ReturnFalse":
                return(false);

            case "ReturnFalseWithResolve":
                conflict.Resolve(RefreshMode.OverwriteCurrentValues);
                return(false);

            case "":
                conflict.Resolve(RefreshMode.KeepCurrentValues);
                break;

            default:
            {
                throw new NotImplementedException(string.Format("ResolveMethod {0} is not defined", current.ResolveMethod));
            }
            }

            return(conflict.IsResolved);
        }