您什么时候会使用进程内 WCF 组件?

发布于 2024-07-10 05:42:48 字数 421 浏览 8 评论 0原文

我正在研究 Juval Lowy 的出色的 WCF 服务编程,并且刚刚使用他的 InProcFactory 类(该类与他的 ServiceModelEx 库一起提供)创建了一个非常简单的进程内组件。

为什么要这样做而不是在项目中只使用常规类? 使用他的方法需要引用他的库并创建一个接口。

我可以想到几个优点:

  • 如果你坚持这样做,你就会 大大减少耦合。
  • 一旦你写完你的进程内 准备使用的组件 进程外或远程无需 改变。

这样做有更多的好处吗?

您是否使用进程内 WCF 组件编写代码?

所有的类都应该是组件吗?

你能在整个解耦的事情上做得太过分吗?

将所有类组件化的缺点是否大于优点? 反之亦然?

I'm studying Juval Lowy's excellent Programming WCF Services and I've just created a really simple in-proc component using his InProcFactory class that comes along with his ServiceModelEx library.

Why would you do this instead of using just regular classes in your project? Using his method requires referencing his library and creating an interface.

I can think of a couple of advantages:

  • If you do this consistently you'll
    reduce coupling considerably.
  • Once you've written your in-proc
    components they're ready to be used
    out-of-proc or remotely without
    change.

Are there more advantages in doing this?

Do you write code with in-proc WCF components?

Should all classes be components?

Can you go totally overboard with the whole decoupling thing?

Do the disadvantages of componentizing all your classes outweigh the advantages? Vice versa?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云柯 2024-07-17 05:42:48

如果您订阅了 IDesign 时事通讯,您就会知道 Juval 已经将每个类作为 WCF 服务进行了一些性能基准测试。 他表示,对于正常的业务应用程序来说,性能是可以接受的。 话虽如此,我认为做这样的事情在学习曲线方面有相当大的开销(也就是说,如果我们都是 WCF 大师,那就不成问题了)。 您还需要执行 perf. 针对您的个人场景进行测试。

因此,我认为 WCF 是他在书中提到的实现 AOP 的方法之一,但正如我已经说过的,实际上 WCF 的学习曲线很高。

If you're subscribed to the IDesign newsletter you would know that Juval has done some performance bench tests with EVERY CLASS as a WCF service. He said that performance was acceptable for a normal business application. Having said that I think there is considerable overhead in terms of learning curve (I.e. if we were all WCF masters it wouldn't be a problem) in doing something like this. You'll also want to do perf. tests for your individual scenario.

So, I think that WCF is one of the ways towards AOP which he mentions in the book however as I've said already practically there is a high learning curve for WCF.

孤檠 2024-07-17 05:42:48

WCF 还提供了一些额外的日志记录和跟踪,这可能会派上用场。 我认为将服务重新配置为远程服务(出于可扩展性或其他原因)的能力可能是使用它的更大原因。

WCF also provides some extra logging and tracing which might come in handy. I think the ability to reconfigure the service as remote (for scalability or whatever) is probably the bigger reason to use this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文