I'm having some routing problems with OData v3, composite keys and deleting items. I've set up my controller and entities as below (stubbed the methods here, they're complete in my implementation) and can run basic queries on the data (filtering etc. for GET)
When I call the url http://localhost:62658/OData/ProductStockLimit(StockLimitGroupId=1,ProductRegexMatch=Test) with DELETE however I keep getting 404's with the message "No HTTP resource was found that matches the request URI"
I assume the routing isn't picking up this method but I have no idea why as all of my other OData routes are working correctly with deletes, the only difference I can see is that this is a composite key one.
Anyone else had this problem?
public class ProductStockLimit
{
[Key, Column(Order = 2)]
public string ProductRegexMatch { get; set; }
[Key, ForeignKey("StockLimitGroup"), Column(Order = 1)]
public int StockLimitGroupId { get; set; }
public virtual StockLimitGroup StockLimitGroup { get; set; }
[Column(Order = 3)]
public double Quantity { get; set; }
}
namespace Website.Areas.OData.Controllers
{
public class ProductStockLimitController : ODataController
{
[EnableQuery(AllowedQueryOptions = AllowedQueryOptions.All)]
public IQueryable<ProductStockLimit> Get()
{
}
public IHttpActionResult Post(ProductStockLimit item)
{
}
public HttpResponseMessage Delete( [FromODataUri]int StockLimitGroupId,[FromODataUri] string ProductRegexMatch)
{
}
}
}