Mitc.Support.Deltas 1.1.1

Mitc.Support.Deltas

Strongly-typed partial update handling for ASP.NET Core PATCH endpoints, inspired by RFC 7386 — JSON Merge Patch.

Quick Start

[HttpPatch("{id}")]
public IActionResult Patch(int id, [FromBody] Delta<Customer> delta)
{
    if (!delta.HasUpdates)
        return NoContent();

    var customer = db.Customers.Find(id);

    delta.ApplyUpdate(customer, c => c.Name);
    delta.ApplyUpdate(customer, c => c.Email);

    db.SaveChanges();
    return Ok(customer);
}

Only the properties present in the JSON body are applied. Absent properties are left unchanged, and properties explicitly set to null are set to their default value.

Derived deltas

For strongly-typed property access, you can derive from Delta<T>:

public class CustomerDelta : Delta<Customer>
{
    public string Name { get => Get<string>(); set => Set(value); }
    public string Email { get => Get<string>(); set => Set(value); }
}

Features

Check if a property was included

if (delta.Updated(c => c.Name))
{
    // Name was present in the request body
}

Retrieve a converted value

if (delta.Updated(c => c.Name, out string name))
{
    // name contains the deserialized value
}

Apply updates with a custom setter

delta.ApplyUpdate(c => c.Email, value => customer.SetEmail(value));

Validate against unknown properties

// Get unknown property names
var unknown = delta.GetUnknownProperties();

// Or throw if any are present
delta.ThrowIfUnknownProperties();

Target Frameworks

net5.0, net6.0, net7.0, net8.0, net9.0

No packages depend on Mitc.Support.Deltas.

Version Downloads Last updated
1.1.7 9 2/18/2026
1.1.3 0 2/18/2026
1.1.2 0 2/12/2026
1.1.1 0 2/12/2026
1.1.0 63 8/18/2025
1.0.9 1 8/18/2025
1.0.8 1 8/6/2025
1.0.7 0 7/18/2025
1.0.6 0 7/18/2025
1.0.5 0 7/18/2025