这是 Crudy 的反模式吗?

编程入门 行业动态 更新时间:2024-10-09 04:26:22
本文介绍了这是 Crudy 的反模式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

目前我正在创建一个 WCF 服务,它必须连接到一个 DAL,它只使用 ADO 和存储过程连接到一个数据库.

Currently I am creating a WCF service which has to connect to a DAL which, just connects to a database using ADO and stored procedures.

DAl 将其响应从数据库写入数据契约,该数据契约通过网络通过服务传递到客户端.

The DAl writes its responses from the database to a datacontract which is passed over the wire to the client via the service.

我读到这可能是反模式CRudy Interface",但我不确定,因为我正在共享数据合同.

I was reading that this may possibly be the anti pattern 'CRudy Interface', but I wasn't sure as I am sharing the datacontract.

如果我使用的是反模式,谁能建议一个更好的模式来用于我需要的行为?

If I am using an anti pattern, can anyone suggest a better pattern to use for the behavior I require?

推荐答案

好吧,对于 CRUDy 模式及其优缺点似乎存在一些争议.至少,我会调用一个服务接口,让你编写这种代码来使用它的反模式(如评论 此处):

Well, there seems to be some controversy about the CRUDy pattern and it's pros and cons. At a minimum, I would call a service interface that makes you write this kind of code to use it an anti-pattern (as commented here):

service.CreateCustomer(c);

foreach(Group group in c.Groups)

  service.AddCustomerToGroup(c.CustomerId, group.GroupId);

foreach(Person person in c.Contacts)

  service.AddCustomerContact(c.CustomerId, person);

暴露 CRUDy 接口本身就不好吗?我不会这么说.重要的是提供一个接口,该接口将

Is exposing CRUDy interfaces bad in itself? I wouldn't say so. What's important is to provide an interface which will

封装有关底层流程的知识不要太健谈

这篇关于这是 Crudy 的反模式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 20:34:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1142761.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:这是   模式   Crudy

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!