{"id":22424326,"url":"https://github.com/cloudfy/patchable","last_synced_at":"2025-08-01T07:32:54.421Z","repository":{"id":65319485,"uuid":"589536809","full_name":"cloudfy/Patchable","owner":"cloudfy","description":"Enables easy patch (partial changes) without using JsonPatch for ASP.NET and ASP.NET Core.","archived":false,"fork":false,"pushed_at":"2023-02-14T06:17:39.000Z","size":45,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-19T06:14:03.827Z","etag":null,"topics":["asp-net-core","asp-net-core-web-api","entity-framework-core","http-patch","json-api","partial-entity-changes"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudfy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-16T10:59:29.000Z","updated_at":"2023-01-17T10:24:30.000Z","dependencies_parsed_at":"2023-02-10T09:00:22.756Z","dependency_job_id":null,"html_url":"https://github.com/cloudfy/Patchable","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfy%2FPatchable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfy%2FPatchable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfy%2FPatchable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudfy%2FPatchable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudfy","download_url":"https://codeload.github.com/cloudfy/Patchable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228348295,"owners_count":17905899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","asp-net-core-web-api","entity-framework-core","http-patch","json-api","partial-entity-changes"],"created_at":"2024-12-05T18:14:56.459Z","updated_at":"2024-12-05T18:14:57.131Z","avatar_url":"https://github.com/cloudfy.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet](https://img.shields.io/nuget/v/Patchable.svg)](https://www.nuget.org/packages/Patchable/) [![GitHub license](https://img.shields.io/github/license/cloudfy/Patchable.svg)](LICENSE)\n\u003cp\u003e\u003c/p\u003e\n\n# Patchable\n\nEnables easy patch (partial changes) without using JsonPatch for ASP.NET and ASP.NET Core.\n\n## Summary\n- [Quick Start](#quick-start)\n- [Introduction](#introduction)\n\n## Quick start\n```powershell\nPS\u003e Install-Package Patchable\n```\n\n## Introduction\nPartial changes of entities is a common task when implementing RESTful services in ASP.NET Web API. RESTful services provide the use of [HTTP PATCH](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) to conduct partial entity updates.\n\nThe ```Patchable``` library enables a convenient approach to only patch partial properties whilst also validating the properties of the containing object. In addition, supporting null value handling (was the property supplied, and was it set to null) is solved.\n\n### Example\nFollow this example to patch a single item.\n\n```c-sharp\n[HttpPatch()]\npublic IActionResult Patch(Patchable\u003cPatchSampleItem\u003e sampleItem)\n{\n    var itemToPatch = new PatchSampleItem()\n    {\n        TextValue = \"This is the original text line\"\n        , GuidValue = Guid.NewGuid()\n        , IntegerValue = 123456\n        , DateValue = DateTime.UtcNow\n    };\n    sampleItem.Patch(itemToPatch);\n\n    return Ok(itemToPatch);\n}\n```\n\nPartial body of request:\n\n```json\n{\n    \"TextValue\" : \"This is altered\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"TextValue\" : \"This is altered\",\n    \"GuidValue\" : \"0B99B1D9-94B3-4254-9DC8-FED54C2798A3\",\n    \"IntegerValue\" : 123456,\n    \"DateValue\" : \"2022-11-16T10:27:07.345059Z\"\n}\n```\n\n# Documentation\n\n## Using Patchable in tiered or CQRS\nWhen using Patchable in a tiered layer application or CQRS scope, add the Nuget on the business layer (tiered) or command side (CQRS). Inheritance will handle the population. It is easy to use Patchable in Entity Framework Core (EFCore) to only map changed properties of a given DbSet\u003c\u003e. This minimized database payload of roundtrips and reduce collissions that create bad data.\n\n## PatchOptions\n\n### Constructor\n| Overload | Description |\n|:-|-|\n| PatchOptions(bool) | Initializes a new instance setting the IgnoreInvalidProperties flag. \n\n### Properties\n| Property | Type | Description |\n|:-|-|-|\n| IgnoreInvalidProperties | bool | Gets whether to ignore invalid properties in the body. If true, an ArgumentNullException is thrown. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudfy%2Fpatchable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudfy%2Fpatchable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudfy%2Fpatchable/lists"}