Is there a more easy way to create a WCF/OData Data Service Query Provider?

Posted by routeNpingme on Stack Overflow See other posts from Stack Overflow or by routeNpingme
Published on 2010-05-27T13:41:37Z Indexed on 2010/06/11 10:12 UTC
Read the original article Hit count: 454

Filed under:
|
|
|

I have a simple little data model resembling the following:

InventoryContext {

IEnumerable<Computer> GetComputers()

IEnumerable<Printer> GetPrinters()

}

Computer {

public string ComputerName { get; set; }

public string Location { get; set; } }

Printer {

public string PrinterName { get; set; }

public string Location { get; set; }

}

The results come from a non-SQL source, so this data does not come from Entity Framework connected up to a database.

Now I want to expose the data through a WCF OData service. The only way I've found to do that thus far is creating my own Data Service Query Provider, per this blog tutorial:

http://blogs.msdn.com/alexj/archive/2010/01/04/creating-a-data-service-provider-part-1-intro.aspx

... which is great, but seems like a pretty involved undertaking. The code for the provider would be 4 times longer than my whole data model to generate all of the resource sets and property definitions.

Is there something like a generic provider in between Entity Framework and writing your own data source from zero? Maybe some way to build an object data source or something, so that the magical WCF unicorns can pick up my data and ride off into the sunset without having to explicitly code the provider?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf