OData / WebApi

OData Web API: A server library built upon ODataLib and WebApi
https://docs.microsoft.com/odata
Other
854 stars 476 forks source link

[vNext] UseOData<T> usage is unclear #533

Open EvanMachusak opened 8 years ago

EvanMachusak commented 8 years ago

From what I have gathered from the samples, my own testing, and stepping through the source code, the only way to activate vNext OData is to:

Is there another mechanism that I'm not seeing?

I'm raising this issue because I just spent 25 minutes trying to figure out why my T in UseOData was failing, and it was because I had set one of my constructor-injected dependencies as a public property, which was naturally an interface and therefore not eligible to be translated into an EDM. I feel as though being forced to create a special class with a series of unimplemented (but not abstract) properties defining my EDM types is poor usage. Why can't I just say something like:

app.UseOData() .WithType<TEntity,TMvcController>(edm => { edm.HasKey(entity => entity.ArbitraryProperty); }); .WithType(); // uses the defaultly-named MVC controller

GunterGlad commented 8 years ago

I have similar issues. I am currently using clr: 1.0.0-rc-16048. I see the current build was done on beta4 (I may be wrong). Is there any plans to get this upgraded. So please if you can fix this issue it would be greatly appreciated.

congysu commented 8 years ago

@EvanMachusak, @GunterGlad: We've just upgraded the project to beta8. Changes are in vNext branch: https://github.com/OData/WebApi/commits/vNext Your help to further update the project to rc is very welcome.

GunterGlad commented 8 years ago

I have submitted a version that has the upgrade in it. Sorry, first time using git hub so may have done it wrong.