0

We are having some discussions about use of WCF and creation of services and client support.

Currently we support a silverlight client by providing silverlight versions of our service libraries client side, so that we can keep the strong typing of our service contract which is defined using interfaces.

This is ok, but having the service defined with interfaces makes it awkward for other clients as the WSDL has a lot of methods return ArrayOfAnyType and everything is just objects at the client end (which can be cast to the correct type, but as I said, its awkward).

We could rewrite our services to use explicit DTOs for the message transfer and recreate our business objects using similar client side libraries, which would make our service much more interoperable.

Doing this though would seem to block off some options for us, such as using EntityFramework and the self tracking entities it provides as these require the same libraries to be shared on client and server and are not interoperable (correct me if I've got this wrong)

It seems like there is a trade off between being interoperable and having access to more functionality out of the box, allowing for quicker development of solutions.

So my question is what advantages do we gain by deciding to be non interoperable and only supporting .net and silverlight client (if supporting silverlight clients can be considered non interoperable)? And what useful .net features do we block ourselves off from by deciding to be interoperable?

Are there standard techniques for allowing both types of solution to co exist, so you can support .net clients using the full range of features available to you, but still support other non .net clients well?

4

1 回答 1

0

您可以为此使用外观模式。

将您当前的逻辑移动到业务层,不要通过 WCF 公开它。

现在为您希望支持的每个合同创建 2 个 WCF 服务。该层将业务层对象映射到合同对象并调用业务层中的功能。

然后,您就可以为每个客户端的所有逻辑和自定义服务提供一个中心位置。

于 2011-04-21T08:39:52.013 回答