SCM

[#1011022] Problem with long running Object Context EF4

View Trackers | Support Requests | Download .csv | Monitor

Date:
2011-04-25 16:51
Priority:
3
State:
Open
Submitted by:
Diane Jewett (jewettdiane)
Assigned to:
Nobody (None)
Category:
Group:
Resolution:
None
 
Summary:
Problem with long running Object Context EF4

Detailed description
Problem saving changes with a long running context in a transaction.
Get an error Disposig the Context and closing the connection.
Doing something similiar to:
http://msdn.microsoft.com/en-us/library/bb738701.aspx

using (TransactionScope transaction =
new TransactionScope(TransactionScopeOption.Required) {
try
{
context.Connection.Open();

returnObj = ExecuteFunction();

context.SaveChanges(SaveOptions.AcceptAllChangesAfterSave);

transaction.Complete();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message, ex);
throw ex;
} finally {
context.Dispose();
}
}


Where Execute function updates multiple records.

Followup

Message
Date: 2011-04-25 19:08
Sender: Diane Jewett

I added the exception logging

Attached Files:

Attachments:
NpgsqlEF4.zip
NpgsqlEF4.zip

Changes:

Field Old Value Date By
File Added598: NpgsqlEF4.zip2011-04-25 19:08jewettdiane
File Added597: NpgsqlEF4.zip2011-04-25 16:51jewettdiane
Powered By FusionForge