WCF 中的请求和响应类型

发布于 2024-09-07 06:50:32 字数 97 浏览 2 评论 0原文

我在项目中看到大量请求和响应类型,以满足作为 WCF 服务公开的所有端点。这似乎需要维护大量重复且简单的代码。

这些类型可以使用属性之类的东西自动生成或完全避免吗?

I see a huge number of request and response types in a project to cater for all the endpoints exposed as WCF services. This seems like an awful lot of repetitive, simple code to maintain.

Can these types be auto-generated or avoided altogether using something like attributes?

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

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

发布评论

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

评论(1

坐在坟头思考人生 2024-09-14 06:50:32

它们可以通过几种方式自动生成。我最熟悉的两个:

Web 服务软件工厂 - 建模版。您维护一个类似 UML 的模型,并让工厂生成您的大部分代码。代码生成为部分类,因此您可以手动添加/覆盖方法和更复杂的架构。

我有时还会在 XML 模式中定义所有数据,然后使用 WSCF.blue 从架构。同样,它创建了部分类,以便您可以调整生成的合约。

They can be autogenerated a few ways. The two I'm most familiar with:

Web Service Software Factory - Modeling Edition. You maintain a UML-like model and let the factory generate much of your code. Code is generated as partial classes so you can manually add/override methods and more complex schema.

I also sometimes define all of the data in XML Schema, then use WSCF.blue to generate the contracts from the schema. Again, it creates partial classes so that you can tweak the generated contracts.

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