Entity version in odata using accept header in web api

I am using Web API to create RESTful services. I decided to using Accept header as a api versioning mechanism by following this implementation. http://blog.maartenballiauw.be/post/2013/03/08/Custom-media-types-for-ASPNET-Web-API-versioning.aspx

Accept: application/json; version=1

For entity standardization and query capabilities, I planned to use Odata. The problem currently I see is that the odata only supports(or only I know) the entity versioning using url.

 modelBuilder1.EntitySet<V1.Product>("Products");
 modelBuilder2.EntitySet<V2.Product>("Products");

 Microsoft.Data.Edm.IEdmModel model1 = modelBuilder1.GetEdmModel();
 Microsoft.Data.Edm.IEdmModel model2 = modelBuilder2.GetEdmModel();

 config.Routes.MapODataRoute("ODataRoute1", "api\v1", model1);
 config.Routes.MapODataRoute("ODataRoute2", "api\v2", model2);

Is there any solution available for to configure odata to consider accept header ?

Thanks in Advance.

Answers


We have a very good sample on versioning using web API OData. You can find it here


Need Your Help

PostgreSQL transaction variables

postgresql concurrency transactions postgresql-9.1

This question is sort of a follow up to this question, but it's different enough of a topic that I feel like it merits it's own discussion. For a bit of background, you can refer to it.

ViewPager and animating content of default fragment

android animation android-fragments android-viewpager

I try to animate the content(textViews etc) of fragments, which are attached to ViewPager, animation works nice when we move from fragment to fragment. I need also animate the fragment which is seen

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.