Topics: General Discussion Forum
Jan 31, 2007 at 6:50 AM
Have anyone had success wiht implementing transactions i WSSF?
I'm currently working on a project with several interresting challenges. First off we have an Employee that is pieced together with data from 4 tables in the database. We made a BusinessEntity of an Employee by using a view and created some stored procedures ourself. The problem is now that when we want to update our Employee we would like to use transactions to ensure that the Employee gets updatet all right.
Have anyone done that, and do you have some pointers in how to do that the best?

One of the factors in our project is that it should be easy to update and extend. We have therefor decided not to change any autogenerated code if possible.

Jais Holstein
(Copenhagen, Denmark)
Jan 31, 2007 at 6:31 PM
Jais, the guidance for doing this is to use the System.Transactions.TransactionScope (I think that's the one) from your business component to ensure a transaction across the database operations. Let me know if this doesn't make sense.

BTW, I'll be in Copenhagen the first week of March. Drop me a line at if you're interested in chatting over a beverage :)

Don Smith
Product Manager
Service Factory
Feb 1, 2007 at 5:58 AM
Hi there guys!.
I want to add some notes from my experience using WSSF and TransactionScope.

When you use TransactionScope with WSSF usually you fall in the issue "promoting the transaction to Distributed Transaction". That is by the design moment which assumes that if you call multiple SqlConnection Open methods (even if the Connection String is the same) the trasaction becomes distributed. Then you must configure the DTC on the client and may be on the server (that was my first workaround). The second and a better workaround: I have downloaded the Enterprise Library 3.0 ( January CTP I think). And have referenced the DataAccess assembly ( is the version). And according to the documentation of the EL 3.0 and to my tests it is working fine now!

BTW, I'll be in Copenhagen on the 21st and the 22nd of Feb :).

Nikolay Yordanov
(Sofia, Bulgaria)
Feb 1, 2007 at 7:18 PM
Thank you for your replies. We have been looking at it today and it looks just like what we were looking for.

Feb 7, 2008 at 3:59 PM
I find entwickler's post very intriguing. Alas I cannot find Enterprise Library 3.0 (January 07 CTP) anywhere.....

Can anybody please tell me where to dowload it from.

Feb 7, 2008 at 4:59 PM
Any reason why you need that "old" version? Anyway, if you need it, perhaps in the entlib forum someone may help.
Feb 8, 2008 at 8:12 AM
Hello Charly

I mentioned in another post 'inheriting' an app which uses Ent Lib 3.1 (May) and WSSF (Dec 2006) and needing to implement Transactions at the BusinessLogic Layer. Firstly I tried using .Net TransactionScope but I found the issue of promoting transactions to distributed level which required setting up DTC on client & server, which I did, however this would still not work as I kept on getting 'The transaction has already been implicitly or explicitly committed or aborted'. From my investigations i suspect this is because my Win 2K3 is virtual. Anyway MSDTC I'm sure is a definatly not the way to go as the I expect overhead would be unacceptable for the speed of throughput I require.

So what do I do? entwicker's post suggests that I could change the DAAB I'm referencing and still use TransactionScope without the worry of DTC so I'ts an option, and hence my post! The only other option is to 'rip' out the Data access layer and replace it with SQLHelper or a home rolled solution and implement SQLTransactions. The dev is too far advanced to replace the WSSF being used.

Maybe (and hopefully) I am missing something simple which will give a quick solution, but I hope you can see my problem. Anyway thanks for your interest, any further guidance appreciated.

Feb 8, 2008 at 9:21 AM
Sorry to catch up with you so late. I am posting some sample code and the issue we are discussing is no longer an issue with 3.1 version.

Sample Code:
public static List<Employee> Add(List<Employee> AddItem)
using (TransactionScope Trans = new TransactionScope())
foreach (Employee Item in AddItem)
Item.ID = Guid.NewGuid();
return AddItem;

private static void InsertDetails(Employee Item)
//TODO - при insert tuka da zapiswam detajlite
if(Item.EmployeeAddresses !=null)
foreach (EmployeeAddress AdresItem in Item.EmployeeAddresses)
AdresItem.EmployeeID = Item.ID;

Item.EmployeeAddresses = EmployeeAddressBL.Add(Item.EmployeeAddresses);

if (Item.EmployeeEducations !=null)
foreach (EmployeeEducation EduItem in Item.EmployeeEducations)
EduItem.EmployeeID = Item.ID;
Item.EmployeeEducations = EmployeeEducationBL.Add(Item.EmployeeEducations);
if (Item.EmployeeSickDays !=null)
foreach (EmployeeSickDays SDItem in Item.EmployeeSickDays)
if (SDItem.Employee == null)
SDItem.Employee = new Employee();
SDItem.Employee.ID = Item.ID;
Item.EmployeeSickDays = EmployeeSickDaysBL.Add(Item.EmployeeSickDays);
if (Item.EmployeeContracts != null)
foreach (EmployeeContract ContractItem in Item.EmployeeContracts)
if (ContractItem.Employee == null)
ContractItem.Employee = new Employee();
ContractItem.Employee.ID = Item.ID;
Item.EmployeeContracts = EmployeeContractBL.Add(Item.EmployeeContracts);

Please tell me if you need something else