I don't know if there is a right or wrong answer to this....However, I will
give my opinion.
First, are you using Sql Server (or another RDBMS)?
......
Option1:
With Sql Server 2000 and 2005, you can handle multiple table
transactions inside a usp (user stored procedure). You can accomplish this
through alot of scalar values OR using XML.
With 2008, you can accomplish this using
http://channel9.msdn.com/posts/ashishjaiman/SQL-Server-2008-Table-valued-parameters/
Table Valued Parameters. I have experience with 2000/2005 and am only
getting into 2008 with this particuliar need.
You would handle the Transactions at the USP level.
Here is the most basic example of a usp transaction on 2 updates:
http://groups.google.com/group/micr...programming/msg/12a7386e84ab4654?dmode=source
THis isn't a great example, but has the nuts/bolts of the logic.
Actually, I would use the:
dbo.uspEmployeeDepartmentJobTitleUpdate
from the next URL I mention immediately below as an example.
Option2:
https://www.microsoft.com/communiti...7ae-bf53-9380538fa8a9&lang=en&cr=US&sloc=&p=1
You can put the transaction code in DotNet code. The above link shows some
examples of that I coded up. I didn't get alot of feedback on the post fyi.
But at least you have the code examples.
The example uses 3 tables, Emp, Dept, JobTitle.
Now, we have to discuss what you mean and I mean by BAL and DAL. Some
people have the BAL call "Helpers" and consider that the DAL. Example. The
BAL calling (directly) the SqlHelper class of the DAAB (circa 4-5 years
ago).
Some people (like me) have a DAL layer, and uses the SqlHelper or
EnterpriseLibrary.Data ~as helpers.....and not "instead of" the DAL.
You can see a code example of this here:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry
(Also check my 1.1 version of that same article at
http://sholliday.spaces.live.com/Blog/ or
http://sholliday.spaces.live.com/feed.rss )
If you're using a true DAL (and not simply (and errantly in my opinion)
calling a Helper class from your BAL).......then you ~can code up the
transactions in the DAL.
If I were talking to 2 different databases, I would use this approach. I
would pick on of the DAL (DotNet) syntaxes from the URL (listed underneath
of Option2 above) and use that.
If I were using a non SQL Server RDBMS like Oracle, I would use this
approach as well...since my experience with Oracle and Xml was not a found
one.
...................
So my nutshell advice:
1. If you're using Sql Server, I would try XML to pass all your data down
and use usp's (BEGIN TRAN, COMMIT TRAN, ROLLBACK TRAN). << My opinion.
2. If you're using multiple databases or something non sql
server.......then (A) Make sure you have an actual DAL layer defined (and
are NOT simply using the "Helper" classes like SqlHelper or
EnterpriseLibrary.Data)........and then put in DotNet transactions. The URL
(mentioned above under Option 2) should provide the syntax(es) for that.
................
Good luck.