views:

22

answers:

0

Hi 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...