Example #1
0
        internal void Apply(T objectToApplyTo, IObjectAdapter <T> adapter)
        {
            switch (OperationType)
            {
            case OperationType.Add:
                adapter.Add(this, objectToApplyTo);
                break;

            case OperationType.Remove:
                adapter.Remove(this, objectToApplyTo);
                break;

            case OperationType.Replace:
                adapter.Replace(this, objectToApplyTo);
                break;

            case OperationType.Move:
                adapter.Move(this, objectToApplyTo);
                break;

            case OperationType.Copy:
                adapter.Copy(this, objectToApplyTo);
                break;

            case OperationType.Test:
                adapter.Test(this, objectToApplyTo);
                break;

            //throw new NotImplementedException("Test is currently not implemented.");
            default:
                break;
            }
        }
Example #2
0
        public void Apply(T objectToApplyTo, IObjectAdapter <T> adapter)
        {
            switch (OperationType)
            {
            case OperationType.Add:
                adapter.Add(this, objectToApplyTo);
                break;

            case OperationType.Remove:
                adapter.Remove(this, objectToApplyTo);
                break;

            case OperationType.Replace:
                adapter.Replace(this, objectToApplyTo);
                break;

            case OperationType.Move:
                adapter.Move(this, objectToApplyTo);
                break;

            case OperationType.Copy:
                adapter.Copy(this, objectToApplyTo);
                break;

            case OperationType.Test:
                adapter.Test(this, objectToApplyTo);
                break;

            default:
                break;
            }
        }
Example #3
0
        public void Apply(TModel objectToApplyTo, IObjectAdapter adapter)
        {
            if (objectToApplyTo == null)
            {
                throw new ArgumentNullException(nameof(objectToApplyTo));
            }

            if (adapter == null)
            {
                throw new ArgumentNullException(nameof(adapter));
            }

            switch (OperationType)
            {
            case OperationType.Add:
                adapter.Add(this, objectToApplyTo);
                break;

            case OperationType.Remove:
                adapter.Remove(this, objectToApplyTo);
                break;

            case OperationType.Replace:
                adapter.Replace(this, objectToApplyTo);
                break;

            case OperationType.Move:
                adapter.Move(this, objectToApplyTo);
                break;

            case OperationType.Copy:
                adapter.Copy(this, objectToApplyTo);
                break;

            case OperationType.Test:
                adapter.Test(this, objectToApplyTo);
                break;

            case OperationType.Invalid:
                throw new JsonPatchException(
                          Resources.FormatInvalidJsonPatchOperation(op), innerException: null);

            default:
                break;
            }
        }
Example #4
0
        public void Apply(object objectToApplyTo, IObjectAdapter adapter)
        {
            if (objectToApplyTo == null)
            {
                throw new ArgumentNullException(nameof(objectToApplyTo));
            }

            if (adapter == null)
            {
                throw new ArgumentNullException(nameof(adapter));
            }

            switch (OperationType)
            {
            case OperationType.Add:
                adapter.Add(this, objectToApplyTo);
                break;

            case OperationType.Remove:
                adapter.Remove(this, objectToApplyTo);
                break;

            case OperationType.Replace:
                adapter.Replace(this, objectToApplyTo);
                break;

            case OperationType.Move:
                adapter.Move(this, objectToApplyTo);
                break;

            case OperationType.Copy:
                adapter.Copy(this, objectToApplyTo);
                break;

            case OperationType.Test:
                adapter.Test(this, objectToApplyTo);
                break;

            default:
                break;
            }
        }