This works across a single DataContext, but not across multiple DataContexts. Ad-free experience sponsored by:. Share on:. On this page:. Is this content useful to you? Consider making a small donation to show your support. Andrei Rinea July 14, In the end I merged the Membership database with the App database.
DotNetShoutout July 14, The worst case was developing on a remote database connected through a VPN for an application that would eventually run on a server with a local database. I ended up using a factory to generate TransactionScopes, so I could use an appSetting in web.
Most of development was done with transactions turned off, but a flip of the appSetting would turn them on for testing when a local database was available. I've also had trouble with nested TransactionScopes. It's supposed to work, and simple examples work, but more complex cases have been problematic. Both need TransactionScopes. The factory approach saved me in that case also; if a TransactionScope already existed, I didn't bother creating a nested transaction.
This was not a DTC issue. Without the factory, one of two symptoms would occur; either the transaction was completed by the nested method, and the calling method couldn't use the transaction any more, or the TransactionScope was disposed by the nested method, and once again the calling method couldn't use it. According to MS documentation, neither of these situations should occur, but as I said, it only works right in simple examples.
For ASP. NET Membership, the solution is to build the membership tables in the application database, so that you can share a single connection string. I mean why linq2sql by default is using readcommited, when to use spanshot isolation and so on - i mean more or less old things in current technologies background linq, wcf.
Any change in Transactions framework in v4 of. Max C July 15, NET 2. But looks like you can now use multiple connections whereas previously you had to be careful not to open a second one. Rick Strahl July 18, If anybody has gotten multiple data context transactions to work without DTC escalation please leave note with how you got this to work.
Molay Ash July 22, Let me explain. Suppose you have a function that is used for deleting record in a particular table i. Now you have another function which is also used for deleting record i. Now if someone try to use both function in a single transaction then as per I have found TransactionScope will not be worked perfectly. BeginTransaction ; this. Data Context. Submit Changes Method Reference Is this page helpful? Please rate your experience Yes No.
Any additional feedback? Namespace: System. Linq Assembly: System. Applies to. SubmitChanges ConflictMode. To focus the question: how does one load-and-update-in-a-transaction records, close the transaction to not lock for any longer than necessary, process the records, then save subsequent changes back to the database.
Please see this question for an answer to a similar, simpler form of the problem. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Ask Question. Asked 10 years, 5 months ago. Active 10 years, 5 months ago. Viewed times. BeginTransaction IsolationLevel. ReadCommitted ; ctx. IsLocked e. SubmitChanges ; trans. Rollback ; eventLog. WriteEntry "Error.
0コメント