This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a bunch of legacy code that uses traditional ADO.Net to do a bunch of SQL statements within a single transaction. I have now updated some of my code base to lightspeed – but this legacy code I don’t want to touch – all except for a little function call that requires I pass in a UOW to do something with. Problem is I cannot create a Context /UOW using an already open connection – so I cannot do the work within my existing transaction. I also cannot create a Context /UOW and then use the connection/transaction created for that in my legacy code. What would you recommend? Is there any way I can access the internal connection and transaction created within a Context/UOF? I realise this relates somewhat to my previous questions – it all stems from having lots of legacy code that I’m not willing to mess with – while still slowly adopting lightspeed. |
|
|
I have noticed that IDbTransaction includes a property "Connection" but the IDbTransaction that is created with UOW.BeginTransaction returns a null in this property... Is that intentional? |
|
|
You could probably use a custom connection strategy to create a UOW over an already open connection, though some care is required (e.g. if you dispose the UOW then it will close the connection). See http://www.mindscape.co.nz/blog/index.php/2009/10/26/database-connection-strategies-in-lightspeed-3/ for info on getting started. The returned transaction returning a null connection is not deliberate, but we would not want this to be the means of access to the underlying connection anyway. |
|