I have not had time to research EF with CSLA, so you are a pioneer :)
I'd be very surprised to find that EF doesn't work with the TransactionScope concept though - it would be shocking to find that they weren't supporting the primary transactional model in .NET. All the Transactional attribute does is put your code in a using block with a TransactionScope object - nothing fancy at all.
What is the exception?
Here is the solution to this issue:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3036946&SiteID=1
More precisely, a hack for this issue J
Sergey Barskiy
Senior Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Piet Koole
[mailto:cslanet@lhotka.net]
Sent: Tuesday, April 22, 2008 9:26 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] Transactional scope gives an error when using
ADO.NET entities
This is de code
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
using (CobraXE.PersonenContext personenContext =
new CobraXE.PersonenContext())
{
// insert Persoon data
//System.Data.Linq.Binary
lastChanged = null;
var data = (from p in
personenContext.Personen
where p.PersoonKey == Key
select p).First<CobraXE.Persoon>();
data.Sofinummer = Sofinummer;
personenContext.SaveChanges();
//mTimestamp =
lastChanged.ToArray();
// update child objects
//DataPortal.UpdateChild(ReadProperty<PersoonResources>(ResourcesProperty),
this);
}
}
This is the exception
First exception
{"The underlying provider failed on Open."}
[System.Data.ProviderException]: {"The underlying
provider failed on Open."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: {"MSDTC on server 'VMBASIS20GB' is
unavailable."}
Message: "The underlying provider failed on Open."
Source: "System.Data.Entity"
StackTrace: " at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean
acceptChangesDuringSave)\r\n at
System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)"
TargetSite: {Void OpenStoreConnectionIf(Boolean,
System.Data.Common.DbConnection, System.Data.Common.DbConnection,
System.String, System.String, Boolean ByRef)}
As printed in the messagebox
{"DataPortal.Update failed (System.Data.ProviderException: The underlying
provider failed on Open. ---> System.Data.SqlClient.SqlException: MSDTC on
server 'VMBASIS20GB' is unavailable.\r\n at
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean
breakConnection)\r\n at
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
Boolean breakConnection)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)\r\n at System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)\r\n at
System.Data.SqlClient.SqlDataReader.ConsumeMetaData()\r\n at
System.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at
System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer,
TransactionManagerRequestType request, String transactionName,
TransactionManagerIsolationLevel isoLevel, Int32 timeout, Sql
InternalTransaction transaction, TdsParserStateObject stateObj, Boolean
isDelegateControlRequest)\r\n at
System.Data.SqlClient.TdsParser.GetDTCAddress(Int32 timeout,
TdsParserStateObject stateObj)\r\n at
System.Data.SqlClient.SqlInternalConnectionTds.GetDTCAddress()\r\n
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction
tx)\r\n at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction
tx)\r\n at
System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction
transaction)\r\n at
System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction
transaction)\r\n at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.SqlClient.SqlConnection.Open()\r\n at System.Data.Entit
yClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition,
DbConnection storeConnectionToOpen, DbConnection originalConnection, String
exceptionCode, String attemptedOperation, Boolean&
closeStoreConnectionOnFailure)\r\n --- End of inner exception stack
trace ---\r\n at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at System.Data.Objects.ObjectContext.SaveChanges(Boolean
acceptChangesDuringSave)\r\n at
System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at
Csla.Reflection.MethodCaller.CallMethod(Ob
ject obj, DynamicMethodHandle methodHandle, Object[] parameters))"}
base {System.Exception}: {"DataPortal.Update failed
(System.Data.ProviderException: The underlying provider failed on Open. --->
System.Data.SqlClient.SqlException: MSDTC on server 'VMBASIS20GB' is
unavailable.\r\n at
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean
breakConnection)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)\r\n at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)\r\n at System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)\r\n at
System.Data.SqlClient.SqlDataReader.ConsumeMetaData()\r\n at
System.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[]
buffer, TransactionManagerRequestType request, String transactionName,
TransactionManagerIsolationLevel
isoLevel, Int32 timeout, SqlInternalTransaction transaction,
TdsParserStateObject stateObj, Boolean
isDelegateControlRequest)\r\n at
System.Data.SqlClient.TdsParser.GetDTCAddress(Int32 timeout,
TdsParserStateObject stateObj)\r\n at
System.Data.SqlClient.SqlInternalConnectionTds.GetDTCAddress()\r\n at
System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction
tx)\r\n at
System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction
tx)\r\n at
System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction
transaction)\r\n at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction
transaction)\r\n at
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)\r\n
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.SqlClient.SqlConnection.Open
()\r\n at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n --- End of inner
exception stack trace ---\r\n at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at System.Data.EntityClient.EntityConnection.Open()\r\n
at System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean
acceptChangesDuringSave)\r\n at
System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at Csla.Reflecti
on.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[]
parameters))"}
_businessObject: {1}
_innerStackTrace: " at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)\r\n
at System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at Csla.Reflection.MethodCaller.CallMethod(Object
obj, String method,
Object[] parameters)\r\n at
Csla.Reflection.LateBoundObject.CallMethod(String method)\r\n at
Csla.Server.SimpleDataPortal.Update(Object obj, DataPortalContext
context)"
BusinessException: {"The underlying provider failed on
Open."}
BusinessObject: {1}
StackTrace: " at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)\r\n
at System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at Csla.Reflection.MethodCaller.CallMethod(Object
obj, String method, Object
[] parameters)\r\n at
Csla.Reflection.LateBoundObject.CallMethod(String method)\r\n at
Csla.Server.SimpleDataPortal.Update(Object obj, DataPortalContext
context)\r\n at Csla.DataPortal.Update(Object obj)\r\n
at Csla.DataPortal.Update[T](T obj)\r\n at
Csla.BusinessBase`1.Save()\r\n at
CTB.Cobra.CobraNexus.WinApp.PersonenForm.saveButton_Click(Object sender,
EventArgs e) in E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.WinApp\\PersonenForm.cs:line
82"
Another possibility is to add an ObjectContextManager.cs in Csla\Data folder which will look very similar to the files ContextManager.cs and ConnectionManager.cs. Except that now you use an ObjectContext instead of a DataContext.
You should then be able to replace:
using (CobraXE.PersonenContext personenContext = new CobraXE.PersonenContext())
with:
using
(var ctx = ObjectContextManager<CobraXE.PersonenContext>.GetManager("yourConnectionString"))where "yourConnectionString" is the one of your Entity Data Model.
Emmanuel.
That exception occurs because you are opening multiple
connections to the database and the DTC is being brought into play. This is a
well-known “feature” of TransactionScope and affects all code that
opens multiple database connections.
As Emmanuel mentions, something like the ConnectionManager or
ContextManager for EF should allow reuse of the connection. I’m sure CSLA
.NET 3.5.x will include some connection manager for EF when I get time to
add/test it.
Or you can configure your machine to enable the DTC (because the
exception indicates you haven’t enabled it on your machine).
Rocky
TransactionScope will use the DTC if more than one database
connection is used within the transaction – even if the second connection
uses the same connection string.
It is possible that EF is opening some connection behind the
scenes – seems probable actually, given your findings. Not much any of us
can do if EF runs off and opens its own connections…
Rocky
From: rogercito
[mailto:cslanet@lhotka.net]
Sent: Monday, December 08, 2008 7:15 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] RE: Transactional scope gives an error when
using ADO.NET entities
Just for feedback about this problem, i coundn't make it
work with the "open" instruction, had to start the DTC.
I have a BB->BLB->BB test conficuration and in the lasr BB child update I
still get the same error stated in the initial post.
private void Child_Update(PruebaTable pruebatable)
{
using (var
ctx =
ObjectContextManager<PruebaCSLAEntities2>.GetManager("PruebaCSLAEntities",
true))
{
ctx.ObjectContext.Connection.Open();
long id = ReadProperty(PruebaTableItemIDProperty);
// get project data
var data = (from p in ctx.ObjectContext.PruebaTableItems
where p.PruebaTableID == pruebatable.PruebaTableID &&
p.PruebaTableListID==id
select p).First();
data.PruebaTableListNota = ReadProperty(PruebaTableItemNotaProperty);
ctx.ObjectContext.SaveChanges();
&nbs
p; MarkOld();
}
}
The only solution I found was starting the service "Distributed
Transaction Coordinator" in START > SETTINGS > CONTROL
PANEL > ADMINISTRATIVE TOOLS > SERVICES
Thanks for the quick reply.
Piet Koole
This
is de code
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
using (CobraXE.PersonenContext
personenContext = new CobraXE.PersonenContext())
{
// insert Persoon
data
//System.Data.Linq.Binary
lastChanged = null;
var data = (from p in
personenContext.Personen
where p.PersoonKey == Key
select p).First<CobraXE.Persoon>();
data.Sofinummer =
Sofinummer;
personenContext.SaveChanges();
//mTimestamp =
lastChanged.ToArray();
// update child
objects
//DataPortal.UpdateChild(ReadProperty<PersoonResources>(ResourcesProperty),
this);
}
}
This is the exception
First
exception
{"The underlying provider failed on Open."}
[System.Data.ProviderException]: {"The
underlying provider failed on Open."}
Data:
{System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: {"MSDTC on server
'VMBASIS20GB' is unavailable."}
Message: "The underlying provider failed
on Open."
Source: "System.Data.Entity"
StackTrace: " at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)\r\n
at System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)"
TargetSite: {Void
OpenStoreConnectionIf(Boolean, System.Data.Common.DbConnection,
System.Data.Common.DbConnection, System.String, System.String, Boolean ByRef)}
As
printed in the messagebox
{"DataPortal.Update failed (System.Data.ProviderException:
The underlying provider failed on Open. --->
System.Data.SqlClient.SqlException: MSDTC on server 'VMBASIS20GB' is
unavailable.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)\r\n at
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
Boolean breakConnection)\r\n at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)\r\n at System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)\r\n at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()\r\n
at System.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at
System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[]
buffer, TransactionManagerRequestType request, String transactionName,
TransactionManagerIsolationLevel isoLevel, Int32 timeout, Sql
InternalTransaction transaction, TdsParserStateObject stateObj,
Boolean isDelegateControlRequest)\r\n at
System.Data.SqlClient.TdsParser.GetDTCAddress(Int32 timeout,
TdsParserStateObject stateObj)\r\n at System.Data.SqlClient.SqlInternalConnectionTds.GetDTCAddress()\r\n
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction
tx)\r\n at
System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction
tx)\r\n at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction
transaction)\r\n at
System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction
transaction)\r\n at
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)\r\n at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)\r\n at
System.Data.SqlClient.SqlConnection.Open()\r\n at System.Data.Entit
yClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n --- End of inner
exception stack trace ---\r\n at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave)\r\n
at System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at Csla.Reflection.MethodCaller.CallMethod(Ob
ject obj, DynamicMethodHandle methodHandle, Object[]
parameters))"}
base {System.Exception}:
{"DataPortal.Update failed (System.Data.ProviderException: The underlying
provider failed on Open. ---> System.Data.SqlClient.SqlException: MSDTC on
server 'VMBASIS20GB' is unavailable.\r\n at
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean
breakConnection)\r\n at
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
Boolean breakConnection)\r\n at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)\r\n at System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject stateObj)\r\n at
System.Data.SqlClient.SqlDataReader.ConsumeMetaData()\r\n at
System.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at
System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer,
TransactionManagerRequestType request, String transactionName,
TransactionManagerIsolationLevel
isoLevel, Int32 timeout, SqlInternalTransaction
transaction, TdsParserStateObject stateObj, Boolean
isDelegateControlRequest)\r\n at System.Data.SqlClient.TdsParser.GetDTCAddress(Int32
timeout, TdsParserStateObject stateObj)\r\n at
System.Data.SqlClient.SqlInternalConnectionTds.GetDTCAddress()\r\n
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction
tx)\r\n at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction
tx)\r\n at
System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction
transaction)\r\n at
System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction
transaction)\r\n at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)\r\n at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)\r\n at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,
DbConnectionFactory connectionFactory)\r\n at
System.Data.SqlClient.SqlConnection.Open
()\r\n at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection,
String exceptionCode, String attemptedOperation, Boolean&
closeStoreConnectionOnFailure)\r\n --- End of inner exception stack
trace ---\r\n at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean
acceptChangesDuringSave)\r\n at
System.Data.Objects.ObjectContext.SaveChanges()\r\n at
CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at Csla.Reflecti
on.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters))"}
_businessObject: {1}
_innerStackTrace: " at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at System.Data.EntityClient.EntityConnection.Open()\r\n
at System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean
acceptChangesDuringSave)\r\n at System.Data.Objects.ObjectContext.SaveChanges()\r\n
at CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, String method,
Object[] parameters)\r\n at
Csla.Reflection.LateBoundObject.CallMethod(String method)\r\n at
Csla.Server.SimpleDataPortal.Update(Object obj, DataPortalContext
context)"
BusinessException: {"The underlying
provider failed on Open."}
BusinessObject: {1}
StackTrace: " at
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean
openCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection, String exceptionCode, String attemptedOperation,
Boolean& closeStoreConnectionOnFailure)\r\n at
System.Data.EntityClient.EntityConnection.Open()\r\n at
System.Data.Objects.ObjectContext.EnsureConnection()\r\n at
System.Data.Objects.ObjectContext.SaveChanges(Boolean
acceptChangesDuringSave)\r\n at System.Data.Objects.ObjectContext.SaveChanges()\r\n
at CTB.Cobra.CobraNexus.Library.Persoon.DataPortal_Update() in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.Library\\Persoon.cs:line
190\r\n at dm(Object , Object[] )\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle
methodHandle, Object[] parameters)\r\n at
Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object
[] parameters)\r\n at
Csla.Reflection.LateBoundObject.CallMethod(String method)\r\n at
Csla.Server.SimpleDataPortal.Update(Object obj, DataPortalContext
context)\r\n at Csla.DataPortal.Update(Object obj)\r\n
at Csla.DataPortal.Update[T](T obj)\r\n at Csla.BusinessBase`1.Save()\r\n
at CTB.Cobra.CobraNexus.WinApp.PersonenForm.saveButton_Click(Object sender,
EventArgs e) in
E:\\Projecten\\CobraNexus\\CTB.Cobra.CobraNexus.WinApp\\PersonenForm.cs:line
82"
Van: RockfordLhotka
[mailto:cslanet@lhotka.net]
Verzonden: dinsdag 22 april 2008 14:59
Aan: Piet Koole
Onderwerp: Re: [CSLA .NET] Transactional scope gives an error when using
ADO.NET entities
I have not had time to research EF with CSLA, so you are a pioneer :)
I'd be very surprised to find that EF doesn't work with the TransactionScope
concept though - it would be shocking to find that they weren't supporting the
primary transactional model in .NET. All the Transactional attribute does is
put your code in a using block with a TransactionScope object - nothing fancy
at all.
What is the exception?
Copyright (c) Marimer LLC