wcf框架/项目删除了很多配置以使用约定优于配置

发布于 2024-10-30 04:08:22 字数 371 浏览 3 评论 0原文

我们正在将 WPF 应用程序迁移到使用 WCF 和 POCO。到目前为止,大约有 10 个服务,但这个数量会随着时间的推移而增长。在我看来,我们必须在 app.config 中重复很多垃圾(相同的文本,我知道它不是垃圾)来连接 WCF 的服务。

在我看来,这是一个使用约定优于配置的好地方。如果我将默认值放在配置部分中并列出/集成哪些服务,则可以在应用程序启动时将它们连接起来。

感觉这也会使部署更容易,因为只需更改一两行(地址等)。

有没有任何框架(做了一些谷歌搜索,但没有找到任何东西)可以做这种事情?如果不是,是因为这是一个愚蠢的想法还是不切实际?

我对 WCF 还算陌生,因此目前可能还没有意识到一些问题。

感谢您提供有关此主题的所有建议。

We are moving a WPF app across to use WCF and POCO. So far there are 10 or so services, but this will grow with time. It seems to me that we are having to repeat a lot of rubbish (the same text, I know its not rubbish) in the app.config to wire up the services for WCF.

It seems to me to be a nice place to work with convention over configuration. If I put what the defaults would be in a config section and listed / integrated what the services are it could wire them up when the application fires up.

It feels like this would also make deployments easier as there would only be one or two lines to change (addresses etc).

Is there any framework out there (did a bit of Googling and didn't find anything) that does this sort of thing? If not, is it because this is a daft idea or not practical to implement?

I am reasonably new to WCF so there could be issues that I am not aware of at this point.

Thanks for any and all advice around this subject.

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

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

发布评论

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

评论(1

女中豪杰 2024-11-06 04:08:22

.NET 4 很好地清理了配置,.NET 4 中的 WCF 4 也有许多合理的“默认值” - 您甚至可能不需要任何额外的配置文件,具有默认端点(一个对应于您的服务实现的每个服务契约)类,以及配置/服务主机中每个定义的基地址)等等。在 WCF 4 中

阅读有关 WCF 4 中新功能的所有信息:

Windows Communication Foundation 4 开发人员简介

阅读、消化、享受! :-)

.NET 4 cleans up the config quite nicely, and WCF 4 in .NET 4 also has lots of sensible "defaults" - you might not even need any additional config files, with the default endpoints (one for each service contract implemented by your service class, and for each defined base address in your config / service host) and so forth in WCF 4.

Read all about the new features in WCF 4 here:

A Developer's Introduction to Windows Communication Foundation 4

Read, digest, enjoy! :-)

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