开发者

Returning EF entities using WCF - Read only web service / public API

开发者 https://www.devze.com 2022-12-27 09:07 出处:网络
I\'m currently migrating an application from Linq-to-SQL & ASP.net Web Services (asmx) to Entity Framework and WCF.

I'm currently migrating an application from Linq-to-SQL & ASP.net Web Services (asmx) to Entity Framework and WCF.

My question is, I have a bunch of POCO classes which i have xml mapping files for (for the linq to sql) I've replaced my linq to sql with an entity framework data model

I've got an interface - something like IService - that has all the methods on it that i need my service to implement - for example:

Product[] GetProductsByKeyword(string keyword);

In the above case, Product is a POCO. I now have them as entities within my ef data model - i'm using .net 4, and could take advantage of poco support, but don't really see the need - This service is strictly read only.

What's the best way of returning entities in my WCF service? I want i开发者_运维知识库t to support other client platforms, not just .net (so php guys could use it)


Use OData. It's extremely simple when you already have an entity model. Here's an example with a schema which may look familiar.

Then you can use PHP just as easily. And lots of other languages and frameworks, too.

0

精彩评论

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

关注公众号