Add PATCH, HEAD, and OPTIONS attributes.
Hi Tom, This is a coincidence. I was just searching of these very attributes in the AttributeRouting codebase today and stumbled upon this post. Do you have a ballpark ETA for this item? I am using AttributeRouting with WebAPI and would much like to use PATCH in my action methods accepting Delta<T> for partial entity updates. TIA
No timeframe. You could just use [HttpRoute("url", HttpMethod.Patch)] for now.
On Mar 19, 2013, at 7:03 PM, abpatel [email protected] wrote:
Hi Tom, This is a coincidence. I was just searching of these very attributes in the AttributeRouting codebase today and stumbled upon this post. Do you have a ballpark ETA for this item? I am using AttributeRouting with WebAPI and would much like to use PATCH in my action methods accepting Delta for partial entity updates. TIA
— Reply to this email directly or view it on GitHubhttps://github.com/mccalltd/AttributeRouting/issues/225#issuecomment-15153260 .
That was preceisley what I was trying to do but the HttpMethod does not seem to have a the "Patch" verb property on it. Am I missing something?
Hmm. I think you are missing something. Can try a spike in the next day or two. Should be there, though.
On Mar 19, 2013, at 8:31 PM, abpatel [email protected] wrote:
That was preceisley what I was trying to do but the HttpMethod does not seem to have a the "Patch" verb property on it. Am I missing something?
— Reply to this email directly or view it on GitHubhttps://github.com/mccalltd/AttributeRouting/issues/225#issuecomment-15155322 .
My reference is coming from the following location. Look right?
System.Net.Http.dll, v4.0.0.0 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Net.Http.dll
For now I ended up defining my own PATCH attribute like so:
public class PATCHAttribute : HttpRouteAttribute
{
///
/// Specify a route for a GET request.
/// </summary>
/// <param name="routeUrl">The url that is associated with this action</param>
public PATCHAttribute(string routeUrl) : base(routeUrl, new HttpMethod("PATCH")) {}
}
and decorating my actions like so: [PATCH("api/Products/{id}",RouteName="PatchProduct")] public HttpResponseMessage PatchProduct(string id,Delta<ProductDTO> productDelta) { //do whatever with the delta }
A side note: I have removed the "DefaultAPI" route from the WebAPIConfig.cs