LinqToExcel icon indicating copy to clipboard operation
LinqToExcel copied to clipboard

LinqToExcel in transaction scope

Open michalczerski opened this issue 10 years ago • 4 comments

I got InvalidOperationException when invoking your awesome library in transaction scope "ITransactionLocal interface is not supported". I can't solve this issue by extracting piece of code outside of transaction due to architecture. Found solution on SO, but your API doesn't allow to change connection string. http://stackoverflow.com/questions/19387695/error-the-itransactionlocal-interface-is-not-supported-by-the-microsoft-ace-o

Can you add some extra parameter to constructor or just add this parameter by default to connection string ?

michalczerski avatar Jun 23 '15 17:06 michalczerski

Seconding this request.

One solution might be to allow arbitrary additions to the connection string via the ExcelQueryFactory, or allowing a ReadOnly access to also specify OLE DB Services=-4 in the query string, which will exclude the connection from pooling and automatic translation enlistment. The former is probably a bit more flexible.

rhelms avatar Feb 02 '17 06:02 rhelms

Bump... Also getting this error as well. I found that someone had a workaround from #15 but I can't find the workaround. https://github.com/paulyoder/LinqToExcel/issues/15

Seems this issue still not being fixed after 2 years?

LeonSutedja avatar Mar 26 '17 23:03 LeonSutedja

As Paul said in issue #15 to the user there, what is the use case? What are you trying to accomplish using transaction scopes?

mrworkman avatar Oct 21 '17 01:10 mrworkman

My use case was creating a transaction scope for a bunch of database transactions that I wanted to tie together (an import from Excel where they all import or none do). However, because I'm processing the Excel file at the same time, LinqToExcel gets caught up in the transaction mechanism and the error occurs.

If I was able to mark the Excel data source as read only, or was able to specify OLD DB Services=-4 in the connection string to the Excel file, then it would not get picked up by the transaction scope.

rhelms avatar Oct 21 '17 03:10 rhelms