5

Just reading up on TransactionScope implementations.

Could someone confirm if this technique is driven by client-side .net, or if it requires something special from specific DB Vendors? Is this a SQL Server only thing?

sgtz
  • 8,849
  • 9
  • 51
  • 91
  • At least for a non-distributed (and non-nested) TS it is just thread-local transaction information that's automatically set for the commands, etc. Never quite sure how nested/distributed scopes work... might want to focus on a specific *aspect* of TS, because even DTC isn't available in all SQL Server isolation levels. –  Mar 29 '12 at 05:43
  • @pst: what do you mean by non-nested. like a one-level transaction? Do they mark / query the thread somehow to discover if there's an existing transaction in play? – sgtz Mar 29 '12 at 05:47
  • Well, it's all done with thread-local information (to handle the dynamic scoping), but that was me hedging my bets -- not all databases support nestable transactions for instance. –  Mar 29 '12 at 05:48
  • (Well, "nestable" = "concurrent transactions" would be a better fit in this case.) –  Mar 29 '12 at 05:59
  • @pst: like if you were to implement this yourself does doing a static lookup on Thread.CurrentContext.ContextID sound appropriate? Is that a unique ID? – sgtz Mar 29 '12 at 06:12
  • @pst: if you want the points, please post an answer. – sgtz Mar 29 '12 at 06:14
  • I'm waiting for a good answer ;-) I would look at the source for the SQLite (and maybe Postgres, etc.) adapters to see how they implement it and/or what they document as issues. I imagine it's all handled through various "enlisting" interfaces. –  Mar 29 '12 at 17:41
  • However, as far as TLS for data there is [ThreadLocal](http://msdn.microsoft.com/en-us/library/dd642243.aspx) (as of .NET 4) or see [Thread Local Storage](http://msdn.microsoft.com/en-us/library/6sby1byh(v=vs.90).aspx) for .NET 2 approaches. –  Mar 29 '12 at 19:26

1 Answers1

1

If your question also includes RDBMS vendors, then SQL Server Compact supports it and so does Oracle.

Mamta D
  • 6,310
  • 3
  • 27
  • 41
  • I should focus the question a bit more. I'm interested in who implements it, but more importantly on the implementation. For example, is it hard to reterofit a DBMS that doesn't implement (if indeed it is a DBMS specific think). The MS documentation that I've seen so far is quite bland on this topic. – sgtz Mar 29 '12 at 05:41