Click here to Skip to main content
15,848,758 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have enterprise library 4.1 in a c# 3.0 app. The database is SQL Server 2008. I have created an entity class in the designer (based on base class 'ObjectContext').
In this entity there is a function that hooks into a stored procedure on the database. The stored procedure handles the insert of a record into a table. Nothing else. There are constraints on this table to stop duplicate values appearing in the table.
The c# loops through a list of objects that represent a record in the db table. Each pass in the loop calls the entity framework object, which in turn calls the db stored procedure. (the call I make to enterprise library is 'SaveChanges').
I have found strange behaviour : when you try and store 1000 records, and one of these inserts conflicts with the constraint on the table. I would expect that 999 records are stored in this case. However, in this case NO records are stored. It is as if enterprise library has wrapped a transaction around the inserts by itself, and has rolled back the whole deal. I certainly haven't coded anything to wrap a transaction around this.
What is going on here?
thanks for any help...

1 solution

The source code for EntLib is available, you are even asked when installing it. Step through the code or look at it to determine what is happening. I haven't looked at it for some time now but I do believe, unless otherwise specified, EntLib will wrap each call in a transaction.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900