泛型中的sql事务 [英] sql transaction in generics

查看:67
本文介绍了泛型中的sql事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在创建一个示例Web应用程序,其中有用户选择的产品列表,这些产品必须存储在数据库中.但是,如果任何特定产品的可用性低于用户要求,我想回滚整个产品transaction.list就是这样.

列表<产品>产品是一个实体对象,由产品属性组成,例如产品名称,可用性,必需等.
请给我一个主意.

在此先谢谢您.

Hi All,

I am creating a sample web application in which i have list of products that the user selected which has to be store in to the database..but if any of the particular products availability is less than that the user required i want to rollback the entire transaction.the list is like this.

List<Product> the product is a entity object which consist of product attributes such as Product name, availability,required etc.
please give me an idea.

Thanks in Advance.

推荐答案

实现此目的的最佳方法是在SP(存储过程)本身中进行检查.但是,如果要在应用程序中执行此操作,则应使用 CP文章,它可能有助于您更好地理解.

希望这会有所帮助.
The best way to achieve this is to put a check in your SP (stored procedure) itself. But if you want to do it in your application you should take help of TransactionScope class.
Here is a CP article which might help you to understand better.

Hope this helps.


这篇关于泛型中的sql事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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