.NET Transactions across multiple business Objects

G

Guest

Hi,

I have an ASP.NET app with a Business Layer and a DataLayer.

In my DataLayer I user the Microsoft Data ApplicationBlocks (Sqlhelper class)

From my ASP.NET Page I call a Save Method on two different Business Objects
to save data to two different tables.

Can I pass a Transaction into both calls so that it is used.

I looked at SqlTransaction but this needs a connection to be opened and then
assign the transaction to the connection. I don't open connections. I simply
pass my connection string to teh ExecuteReader on my SqlHelper Class.

Any advice is much appreciate on how I can use Transactions across multiple
business objects is appreciated.


Thanks.
 
M

Matt Noonan

C said:
Hi,

I have an ASP.NET app with a Business Layer and a DataLayer.

In my DataLayer I user the Microsoft Data ApplicationBlocks
(Sqlhelper class)

From my ASP.NET Page I call a Save Method on two different Business
Objects to save data to two different tables.

Can I pass a Transaction into both calls so that it is used.

I looked at SqlTransaction but this needs a connection to be opened
and then assign the transaction to the connection. I don't open
connections. I simply pass my connection string to teh ExecuteReader
on my SqlHelper Class.

Any advice is much appreciate on how I can use Transactions across
multiple business objects is appreciated.

I remember having to add or modify some of the method overloads to get
transaction support working. Contact me at the web site below and I will see
if I can dig up the code and email it to you.
 
M

Marina Levit [MVP]

I am not familiar with the data application block. But if it does not
provide support for this, then perhaps you are better off writing your own
code to do all this. You can still wrap it up, such that you are reusing
code throughout your app, and not literally having to put all the little
details of data access code into every method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top