ObjectContextManager Suggestion

ObjectContextManager Suggestion

Old forum URL: forums.lhotka.net/forums/t/6939.aspx


smims posted on Wednesday, May 13, 2009

I was wanting to suggest that on the ObjectContextManager.GetManager method, a bool parameter be added to give the option of opening the connection to the database. I've noticed that if I use the Transactional attribute ([Transactional(TransactionalTypes.TransactionScope)]) with my CRUD operations, I get an error because another connection is being opened. To fix this, it was suggested that I simply open the connection (manager.ObjectContext.Connection.Open();) before firing off my CRUD operation. I think it would be good to add this as a parameter so that connections could be opened by the parent/child accordingly.

Thanks,
Seth Mims (SMIMS)

ajj3085 replied on Wednesday, May 13, 2009

If ObjectContextManager is anything like Csla.ContextManager, it should be handling this already... that's the point of the ContextManager, to ensure only one connection is opened.

sergeyb replied on Wednesday, May 13, 2009

This is definitely an issue in EF v1, and it is a known one. You must open the connection before firing submit changes in EF, or it will delegate to MSDTC.

Sergey Barskiy
Principal Consultant
office: 678.405.0687 | mobile: 404.388.1899

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

-----Original Message-----
From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Wednesday, May 13, 2009 8:44 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] ObjectContextManager Suggestion

If ObjectContextManager is anything like Csla.ContextManager, it should be handling this already... that's the point of the ContextManager, to ensure only one connection is opened.

Copyright (c) Marimer LLC