JsonPatchDocument<TModel> Class

Inheritance Hierarchy

  • System.Object
  • Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>

Syntax

public class JsonPatchDocument<TModel> : IJsonPatchDocument where TModel : class

GitHub

View on GitHub

Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>

Constructors

Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.JsonPatchDocument()
public JsonPatchDocument()
JsonPatchDocument(System.Collections.Generic.List<Microsoft.AspNet.JsonPatch.Operations.Operation<TModel>>, IContractResolver)
Arguments:
  • operations (System.Collections.Generic.List{Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}}) –
  • contractResolver (IContractResolver) –
public JsonPatchDocument(List<Operation<TModel>> operations, IContractResolver contractResolver)

Properties

ContractResolver()
Return type:IContractResolver
public IContractResolver ContractResolver { get; set; }
Operations()
Return type:System.Collections.Generic.List{Microsoft.AspNet.JsonPatch.Operations.Operation{{TModel}}}
public List<Operation<TModel>> Operations { get; }

Methods

Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Add<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, TProp)

At value at end of list

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) – path
  • value (TProp) – value
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Add<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, TProp, System.Int32)

Add value to list at given position

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) – path
  • value (TProp) – value
  • position (System.Int32) – position
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value, int position)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Add<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, TProp)

Add operation. Will result in, for example, { “op”: “add”, “path”: “/a/b/c”, “value”: [ “foo”, “bar” ] }

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) – path
  • value (TProp) – value
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
ApplyTo(TModel)
Arguments:
  • objectToApplyTo (TModel) –
public void ApplyTo(TModel objectToApplyTo)
ApplyTo(TModel, Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter<TModel>)
Arguments:
  • objectToApplyTo (TModel) –
  • adapter (Microsoft.AspNet.JsonPatch.Adapters.IObjectAdapter{{TModel}}) –
public void ApplyTo(TModel objectToApplyTo, IObjectAdapter<TModel> adapter)
ApplyTo(TModel, System.Action<Microsoft.AspNet.JsonPatch.JsonPatchError<TModel>>)
Arguments:
  • objectToApplyTo (TModel) –
  • logErrorAction (System.Action{Microsoft.AspNet.JsonPatch.JsonPatchError{{TModel}}}) –
public void ApplyTo(TModel objectToApplyTo, Action<JsonPatchError<TModel>> logErrorAction)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Copy<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>)

Copy from a position in a list to the end of another list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionFrom (System.Int32) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Copy<TProp>(Expression<Func<TModel, IList<TProp>>> from, int positionFrom, Expression<Func<TModel, IList<TProp>>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Copy<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32)

Copy from a position in a list to a new location in a list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionFrom (System.Int32) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionTo (System.Int32) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Copy<TProp>(Expression<Func<TModel, IList<TProp>>> from, int positionFrom, Expression<Func<TModel, IList<TProp>>> path, int positionTo)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Copy<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32, System.Linq.Expressions.Expression<System.Func<TModel, TProp>>)

Copy from a position in a list to a new location

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionFrom (System.Int32) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Copy<TProp>(Expression<Func<TModel, IList<TProp>>> from, int positionFrom, Expression<Func<TModel, TProp>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Copy<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>)

Copy to the end of a list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Copy<TProp>(Expression<Func<TModel, TProp>> from, Expression<Func<TModel, IList<TProp>>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Copy<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32)

Copy from a property to a location in a list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionTo (System.Int32) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Copy<TProp>(Expression<Func<TModel, TProp>> from, Expression<Func<TModel, IList<TProp>>> path, int positionTo)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Copy<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, System.Linq.Expressions.Expression<System.Func<TModel, TProp>>)

Copy the value at specified location to the target location. Willr esult in, for example: { “op”: “copy”, “from”: “/a/b/c”, “path”: “/a/b/e” }

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Copy<TProp>(Expression<Func<TModel, TProp>> from, Expression<Func<TModel, TProp>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.GetOperations()
Return type:System.Collections.Generic.List{Microsoft.AspNet.JsonPatch.Operations.Operation}
public List<Operation> GetOperations()
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Move<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>)

Move from a position in a list to the end of another list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionFrom (System.Int32) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Move<TProp>(Expression<Func<TModel, IList<TProp>>> from, int positionFrom, Expression<Func<TModel, IList<TProp>>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Move<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32)

Move from a position in a list to another location in a list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionFrom (System.Int32) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionTo (System.Int32) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Move<TProp>(Expression<Func<TModel, IList<TProp>>> from, int positionFrom, Expression<Func<TModel, IList<TProp>>> path, int positionTo)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Move<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32, System.Linq.Expressions.Expression<System.Func<TModel, TProp>>)

Move from a position in a list to a new location

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionFrom (System.Int32) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Move<TProp>(Expression<Func<TModel, IList<TProp>>> from, int positionFrom, Expression<Func<TModel, TProp>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Move<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>)

Move to the end of a list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Move<TProp>(Expression<Func<TModel, TProp>> from, Expression<Func<TModel, IList<TProp>>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Move<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32)

Move from a property to a location in a list

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) –
  • positionTo (System.Int32) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Move<TProp>(Expression<Func<TModel, TProp>> from, Expression<Func<TModel, IList<TProp>>> path, int positionTo)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Move<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, System.Linq.Expressions.Expression<System.Func<TModel, TProp>>)

Removes value at specified location and add it to the target location. Will result in, for example: { “op”: “move”, “from”: “/a/b/c”, “path”: “/a/b/d” }

Arguments:
  • from (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Move<TProp>(Expression<Func<TModel, TProp>> from, Expression<Func<TModel, TProp>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Remove<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>)

Remove value from end of list

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) – target location
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Remove<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, System.Int32)

Remove value from list at given position

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) – target location
  • position (System.Int32) – position
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path, int position)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Remove<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>)

Remove value at target location. Will result in, for example, { “op”: “remove”, “path”: “/a/b/c” }

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, TProp>> path)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Replace<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, TProp)

Replace value at end of a list

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) – target location
  • value (TProp) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Replace<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>>, TProp, System.Int32)

Replace value in a list at given position

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},System.Collections.Generic.IList{{TProp}}}}) – target location
  • value (TProp) –
  • position (System.Int32) – position
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value, int position)
Microsoft.AspNet.JsonPatch.JsonPatchDocument<TModel>.Replace<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>>, TProp)

Replace value. Will result in, for example, { “op”: “replace”, “path”: “/a/b/c”, “value”: 42 }

Arguments:
  • path (System.Linq.Expressions.Expression{System.Func{{TModel},{TProp}}}) –
  • value (TProp) –
Return type:

Microsoft.AspNet.JsonPatch.JsonPatchDocument`1

public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, TProp>> path, TProp value)