Transaction Script(事务代码)

Organize Bussiness Logic by procedures that carry out what need to be done in a transaction

按照解决事务的过程来解决商业逻辑.

Most bussiness applications can be thounght of as a series of transactions, a transaction may view some information orgnized in a particular way. Another will make changes the database.Each interaction between a client system and server system contains a certain amount of logic . In some case this can be as simple as  just displaying some information that's in the database. In others this may invole many steps of validations.and  calculations

大部分的商业程序可以被以为成一系列的事务。 一种事务可能是显示一些用特定方式组成的信息。另外的可能是对数据库做一些更改。客户端和服务器端的每一次交互都包含了一定数量的逻辑。在一些情况下可能只有显示存贮在数据库中的一些信息。此外,也可能包含了多步验证或计算。

A Transaction script orgnizes all this logic primarily as a single procedure,making calls directly to the database or throw a thin database wrapper. Each transaction will hava its own Transation Script,Although common subtask can be broken out into sub-procedures. Each Transation Script is public method on a class

事务脚本首先组织他的逻辑成一个单独的过程,直接访问数据库或者是通过一个简单的数据库封装。每个事务都有自己的事务脚本,尽管子任务可以被拆成子过程。每个事务脚本都是在雷上面建立一个公共方法。

How it Works

With Transation Script  this logic is primarily organized by the transactions  that you do with the system.I f your need is to book a hotel room ,the logic to check the room is avialable,calculate the rates; and update the database is found inside the book hotel room procedure.

事务脚本的逻辑首先是由你处理的系统的事物组成的。假如你需要预定宾馆的房间。 事务的逻辑就是检查这个房间是不是可以用,计算租金,更新在预定旅馆房间的数据库。

For simple cases, there isn't really much to say about how you organize this, like any program,you should  structure the code into modules in away that makes sense. Unless the transacton is particularly complicated that won't be much of a challege. One of the benefits of this approach is that you don't need to worry about what other transactions are doing.Your task is to get the input ,interrogate the database,munge, and save results to the datebase

对于简单情况来说。怎样组织脚本没有太多好说的。当然,像其他程序,你应该合理的把代码组成单元结构。
除非这个事务非常复杂,没有必要去冒这个险。这样处理的方法有个好处就是米不必担心其它事务是怎样工作的。你的工作就是,接受输入,询问数据库,显示,保存数据到数据库。

where you put the Transaction Script will depend on how you orgnize your layers .It may be in a server page,CGI script,distributesession object .whatever  your architecture there is some controller that initiate everything that goes on. for a simple Transavction Script the business logic can be placed in that transaction controller module. either as in line code within the handling of the request.or(better) broken into some separate routines

在什么地方存放你的事务脚本依赖于你怎么组织你的层次。他可能在一个服务器的页面上,CGI脚本上。分布的session对象上。不管你怎样组织你的架构,总会有某个事务控制器厨师每件事是怎样工作的,一个简单的事务脚本业务逻辑可以放在该事物的事务控制模块。或者作为一个内部代码放在处理的请求中,或者(更好 )拆分成单独的程序。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值