开发者

OData / WCF Data Services / EDM - Mapping to disparate data

开发者 https://www.devze.com 2023-03-31 12:06 出处:网络
I\'m researching OData as a RESTful interface fo开发者_如何学Pythonr a database. The data is structured in a very unusual way and normal tables and rows do not apply, in fact, some stuff just exists i

I'm researching OData as a RESTful interface fo开发者_如何学Pythonr a database. The data is structured in a very unusual way and normal tables and rows do not apply, in fact, some stuff just exists in in-memory collections and objects.

Can I build my own arbitrary mapping system between the entities that make up 'feeds' and the sources behind, this might mean aggregating from sources and building the entities on the fly?

I'm just looking for yes/no (why not) and maybe some pointers to relevant reading material.

Many thanks

Luke


Yes and no.

You can build an OData feed of anything. In a WCF Data Service implementation of same, you can implement IDataServiceMetadataProvider.

However, the easiest way to define an EF data service is:

public class MyOData : DataService<MyObjectContext>

...and that won't work if you need to return non-entity objects. Such services are limited to entities and simple types only.

So yes, you can do it, but it's quite a bit more work than the one-liner above!

0

精彩评论

暂无评论...
验证码 换一张
取 消