Transaction Script(事务代码)

论坛 期权论坛 脚本     
已经匿名di用户   2022-4-26 15:52   2762   0
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 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP