WCF服务设计模式 [英] WCF Service design pattern

查看:158
本文介绍了WCF服务设计模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个WCF服务。这样做最好的设计模式是什么?
例如三个这样分开的项目:

I want to create a WCF service. What is the best design pattern to do this? For example three seperated projects like this:

1)DataContract

2)BusinessLogic

3)SvcHostProject

1) DataContract
2) BusinessLogic
3) SvcHostProject

推荐答案

这听起来不太好,尽管我可能会将DataContract和SvcHostProject组合起来,引用WCF二进制文件,并且似乎具有相同的粗粒度责任(即,除非您正在考虑创建通用ServiceHost)。

That doesn't sound too bad, although I'd probably combine the DataContract and the SvcHostProject as they would both have to reference the WCF binaries and seem to share the same coarse-grained responsibility (that is, unless you are thinking about creating a general-purpose ServiceHost).

您可能需要请参阅关于使WCF服务更可测试的(旧)帖子: http://blogs.msdn.com/b/ploeh/archive/2008/07/12/an-overview-of-unit-testing- duplex-wcf-services-and-clients.aspx 虽然它涉及双工服务,但您可以轻松地推断如何处理更多正常请求响应服务。

You might want to see the (old) post about making WCF services more testable: http://blogs.msdn.com/b/ploeh/archive/2008/07/12/an-overview-of-unit-testing-duplex-wcf-services-and-clients.aspx Although it talks about duplex services, you can easily extrapolate how to deal with more 'normal' request-response services as well.

这篇关于WCF服务设计模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆