|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Determining the Better Approach of Transaction in n-tier Application Model and where Transactions arI have the scenario. I m building an application either in asp.net or window application. This application is base on n-tier application model. Let us take example of Northwind Database in SQL SERVER. i build an asp.net page. On that page i place the grid with one template column. In that column i put HTML Table with two rows. In First row there are one combobox and two textboxes. In the second row there is another DataGrid means Inner DataGrid. I select the data from the database and bind it with page. the data is shown in my required formate. When i click on the edit button then that row comes into edit mode. At that time i insert some rows in ther inner datagrid and delete some rows and update some rows. Then i click on update button. At behind i design the 3-tier application model. Now i update my database. The changes i made must be in a transaction. for example the tables are Order, OrderDetail in Northwind Database The Outer DataGrid show the data from Order Table (eg, columns shown are OrderID,CustomerName,CompanyName) The Inner DataGrid show the data from OrderDetail on the basis of OrderID from the Order Table. I have two classes in business layer one is BusinessLayer.Order, second is BusinessLayer.OrderDetail At DAL there are some methods which insert, update, and delete the records. there are two classes OrderDAL and OrderDetailDAL. from Page i call the update() method of BusinessLayer.Order Class. This method call the Update() method of OrderDAL, and second call is Update() of BusinessLayer.OrderDetail class The Update() method of BusinessLayer.OrderDetail call the Update() method of OrderDetailDAL. My Problem is i want to do all this things in one transaction. How Can I do that? The second question is Where i start the transaction (I think In business layer bcoz i call all methods here). Then next Question is What is the better approach of Transaction in this scenario, I mean to ask whether .Net Transaction is Better or MTS DTC (COM+) Transaction If Some One Answers that Manual transaction (.Net Transaction) is better. Then please explain how can i make that Business Layer Method to maintain a transaction. I m not using Business Layer CRUD Behaviour. Thanks Muhammad Jamil Nawaz Hi Muhammad:
In general I'd only recommend using MSDTC if your transactions need to be distributed across multiple servers, otherwise it only adds complications and overhead to what can be a simple transaction you start in your business layer. -- Show quoteScott http://www.OdeToCode.com/blogs/scott/ On Tue, 29 Mar 2005 15:35:06 +0500, "msnews.microsoft.com" <jamfiz***@hotmail.com> wrote: >Hello, > >I have the scenario. I m building an application either in asp.net or window application. This application is base on n-tier application model. >Let us take example of Northwind Database in SQL SERVER. >i build an asp.net page. On that page i place the grid with one template column. In that column i put HTML Table with two rows. In First row there are one combobox and two textboxes. In the second row there is another DataGrid means Inner DataGrid. I select the data from the database and bind it with page. the data is shown in my required formate. When i click on the edit button then that row comes into edit mode. At that time i insert some rows in ther inner datagrid and delete some rows and update some rows. Then i click on update button. At behind i design the 3-tier application model. Now i update my database. The changes i made must be in a transaction. > >for example the tables are Order, OrderDetail in Northwind Database >The Outer DataGrid show the data from Order Table (eg, columns shown are OrderID,CustomerName,CompanyName) >The Inner DataGrid show the data from OrderDetail on the basis of OrderID from the Order Table. > >I have two classes in business layer >one is BusinessLayer.Order, second is BusinessLayer.OrderDetail > >At DAL there are some methods which insert, update, and delete the records. >there are two classes OrderDAL and OrderDetailDAL. > >from Page i call the update() method of BusinessLayer.Order Class. >This method call the Update() method of OrderDAL, and second call is Update() of BusinessLayer.OrderDetail class >The Update() method of BusinessLayer.OrderDetail call the Update() method of OrderDetailDAL. > >My Problem is i want to do all this things in one transaction. How Can I do that? >The second question is Where i start the transaction (I think In business layer bcoz i call all methods here). >Then next Question is What is the better approach of Transaction in this scenario, I mean to ask whether .Net Transaction is Better or MTS DTC (COM+) Transaction >If Some One Answers that Manual transaction (.Net Transaction) is better. Then please explain how can i make that Business Layer Method to maintain a transaction. >I m not using Business Layer CRUD Behaviour. > >Thanks > >Muhammad Jamil Nawaz |
|||||||||||||||||||||||