开发者

WCF - use same type across multiple services

We are starting to build a common entity model using Entity Framework v1. The goal is to expose various common operations as services that can be used by several different clients. The problem we are running into is reusing the types across multiple services. Example:

Service1 (at http://example/service1/service.svc) returns a List

Service2 (at http://example/service2/service.svc) returns a Review object which has referen开发者_Python百科ce to a Product object.

I would like to reference both of these services in my client apps (typically Silverlight) but have the Product type from both services be the same. How do I go about doing this?


Sounds like a common library with interfaces/datacontracts is what is needed.

It would contain IProduct/IProductDataContract which your services should return.

This would then be shared across all three. The concrete implementation woul dthen be down to each services, just as long as they conform to the data contract/interface.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜