ADO.Net与交易 [英] ADO.Net with Transcations

查看:107
本文介绍了ADO.Net与交易的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在为我的开发团队编写一个通用的DAL层,因为我们不想将连接的访问​​权限授予开发人员.我被困在提供处理面向事务的查询的选项方面.有人可以照亮吗?

因此,假设我有3个查询,这些查询必须在一个事务下执行.由于开发人员无权访问Connection,因此无法创建事务.

我是否应该从客户端获取一系列查询和参数,并在事务块内执行?这是正确的方法.

注意:-我没有使用ORM,因此也无法使用命令模式.

谢谢

Hi,

I''m writing a generic DAL layer for my development team because we dont want to give access of connection to the developers. I''m stuck in terms of providing option to handle Transaction oriented queries. Could some one throw light?

So, lets say I''ve 3 queries which have to be executed under one transaction. Since developer dont have access to Connection they can not create transactions.

Shall I take array of queries and parameters from client and execute within the Transaction Block? Is it a right approach.

Note:- I''m not using ORM hence I can not use Command Patterns also.

Thanks

推荐答案

您为什么不授予开发人员访问Connection对象的权限?

抱歉,我不认为合并查询并在Transaction Block中执行它们是最好的方法.恕我直言,我认为您至少应该开发人员访问System.Transaction命名空间中的某些方法.

请参阅本文 .NET Framework 2.0中的System.Transactions简介,并进行了关于您的DAL会喜欢一些TransactionScope类.
Why dont you want to give the developers access to the Connection object?

Sorry I dont think combining queries and executing them in a Transaction Block is the best approach. IMHO I think you should at least dev''s access to some methods in the System.Transaction namespace.

See this article Introducing System.Transactions in the .NET Framework 2.0 and have a brainstorming session about giving your DAL some TransactionScope class lovin.


这篇关于ADO.Net与交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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