title: 406 (NotAcceptable) response from PATCH request in EntitySetController. Web API 2.1. OData
body: <p>I am very much puzzled and hope somebody can shed any light. After upgrading to the latest version of Web API (from Microsoft.AspNet.WebApi.xxx 5.0.0. to Microsoft.AspNet.WebApi.xxx 5.1.2) OData's EntitySetController stopped processing PATCH verbs and returns 406 (Not Acceptable) code instead. </p>
  
  <p>The implementation hasn't changed: </p>
  
  <pre class="lang-cs prettyprint-override"><code>public class ODataAnnouncementController : EntitySetController&lt;TEntity, TKey&gt; where TEntity : class
  {
      (...)
  
      protected override Announcement PatchEntity(Guid key, Delta&lt;Announcement&gt; patch)
      {
          var announcement = getEntityByKeyOrThrowException(key);
          patch.Patch(announcement);
          AnnouncementManager.Instance.Save(announcement, true);
          return announcement;
      }
  }
  </code></pre>
  
  <p>The request hasn't changed either:</p>
  
  <blockquote>
    <p>Accept: application/json</p>
    
    <p>Content-Type: application/json; charset=utf-8</p>
    
    <p>PATCH: http://{url}/odata/Announcement(guid'62E34FB3-A37E-413F-9843-642D95BA580A')</p>
    
    <p>{"Description":"Patched description from Unit Test"}</p>
  </blockquote>
  
  <p>Breakpoint inside the method is not being hit as if "Delta&lt;Announcement>&gt; patch" has never deserialized. The only condition under which it actually does hit the breakpoint inside the method is when a request BODY is empty resulting with patch object being null of course.</p>
  
  <p>All other verbs (GET, POST, PUT, DELETE) work OK.</p>
  
  <p>This used to work before. Is anybody aware of any breaking changes for Web API 2.1 in regards to PATCH? How else could I troubleshoot it? </p>
  
  <p>Thank you so much </p>
  
  <p>Bill</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here is the C# model:
  </p>
  
  <pre><code>[Serializable]
  [DataContract]
  public class Announcement
  {                       
      private Guid _announcementID;
      private string _description;
      private bool _isPrivate;
      private DateTime _createdTime;
      private Nullable&lt;Guid&gt; _membershipID;
  
      [DataMember]
      public Guid AnnouncementID
      {
          get { return this._announcementID; }
          set { this._announcementID = value; }
      }
      [DataMember]
      public string Description
      {
          get { return this._description; }
          set { this._description = value; }
      }       
      [DataMember]
      public bool IsPrivate
      {
          get { return this._isPrivate; }
          set { this._isPrivate = value; }
      }
      [DataMember]
      public DateTime CreatedTime
      {
          get { return this._createdTime; }
          set { this._createdTime = value; }
      }
      [DataMember]
      public Nullable&lt;Guid&gt; MembershipID
      {
          get { return this._membershipID; }
          set { this._membershipID = value; }
      }
  }
  </code></pre>
  
  <p>I use explicit data model:</p>
  
  <pre class="lang-cs prettyprint-override"><code>var routingConventions = ODataRoutingConventions.CreateDefault();
  config.Routes.MapODataRoute(
              routeName: "ODataRoute",
              routePrefix: "odata",
              model: BuildExplicitODataModel(),
              pathHandler: new DefaultODataPathHandler(),
              routingConventions: routingConventions  
          );
  
  public static IEdmModel BuildExplicitODataModel()
  {
  ODataModelBuilder modelBuilder = new ODataModelBuilder();
  var announcementSet = buildAnnouncementModel(modelBuilder);
  return modelBuilder.GetEdmModel();
  }
  
  private static EntitySetConfiguration&lt;Announcement&gt; buildAnnouncementModel(ODataModelBuilder modelBuilder)
  {
          var announcementSet = modelBuilder.EntitySet&lt;Announcement&gt;("Announcement");
          announcementSet.HasEditLink(
              entityContext =&gt; entityContext.Url.ODataLink(
                  new EntitySetPathSegment(entityContext.EntitySet.Name),
                  new KeyValuePathSegment(ODataUriUtils.ConvertToUriLiteral(entityContext.EntityInstance.AnnouncementID, ODataVersion.V3))),
              followsConventions: true);
  
          announcementSet.HasIdLink(
              entityContext =&gt; entityContext.Url.ODataLink(
                  new EntitySetPathSegment(entityContext.EntitySet.Name),
                  new KeyValuePathSegment(ODataUriUtils.ConvertToUriLiteral(entityContext.EntityInstance.AnnouncementID, ODataVersion.V3))),
                  followsConventions: true);
  
          var announcement = announcementSet.EntityType;
          announcement.HasKey(p =&gt; p.AnnouncementID);
          announcement.Property(p =&gt; p.Description);
          announcement.Property(p =&gt; p.IsPrivate);
          announcement.Property(p =&gt; p.CreatedTime);
          announcement.Property(p =&gt; p.MembershipID);
          return announcementSet;
  }
  </code></pre>
  
  <p>Here is request payload:</p>
  
  <blockquote>
    <p>PATCH http://{url}/odata/Announcement(guid'62E34FB3-A37E-413F-9843-642D95BA580A')<br/>
    Accept: application/json<br/>
    Content-Type: application/json; charset=utf-8</p>
  </blockquote>
  
  <p>BODY:</p>
  
  <blockquote>
    <p>{"Description":"Patched description from Unit Test"}</p>
  </blockquote>