[C#]The returned value of DataContext.ExecuteCommand when executing stored procedures.

In our project, SQL scripts(CRUD in specific) are executed using the class “DataContext” in combination with LinqToSQL,
and then of course, when the method “ExecuteCommand” is invoked, the returned value indicates the rows updated.

When the SQL command executed is simply just an INSERT/UPDATE/DELETE, the result is as obvious as ever.
But when it comes to stored procedures, things might not be that simple. 繼續閱讀 “[C#]The returned value of DataContext.ExecuteCommand when executing stored procedures.”

新、舊系統在一起的交易之路 ~ 取得 Spring.NET 的 Connection 及 Transaction

我們有舊的元件(Workflow),連接DB是透過自行封裝 Ado.NET 的元件,
而到新開發的系統,則是使用 Spring.NET + NHibernate 。
當新、舊交雜在一起使用時,交易該如何控管呢?
最簡單的就是用 TransactionScope 去包起來,
但這時候 MSDTC 就跑起來了。
但是很多單位現在都不給開 MSDTC 了,
那要怎麼辦呢? 取得 DB Connection 及 Transaction 往內傳嗎?
要如何取得 Spring.NET 中的 System.Data.Common.DbTransaction 物件呢?

繼續閱讀 “新、舊系統在一起的交易之路 ~ 取得 Spring.NET 的 Connection 及 Transaction”