How to make a transaction flow from Navision to a C# component registered for COM interop?
In my context I have Navision involved, but perhaps this is related to every COM interop scenario, I don't know.
Anyway, the situation: - I've a simple C# component registered for COM Interop - I call it from Navision, just before inserting a new record (for who knows Navision, inside an 'OnInsert' trigger, thus in the context of a transaction)
I was expecting to have an ambient transaction, but System.Tran开发者_JAVA百科sactions.Transaction.Current is null.
Am I missing something? Are there particular techniques I should adopt to make the transaction flow into my interop component?
Are you trying to begin a transaction in NAV and then access that transaction using your COM object?
It sounds like the System.Transactions.Transaction.Current value is null because you haven't initialised a transaction in your COM object - can you post a code sample of it?
Although from your post it sounds like you're expecting the Transaction.Current value to refer to the transaction you have initiated in NAV and I don't think this is what will happen, or is even possible!
What is your COM object trying to do with the transaction? Perhaps there is a different approach we could take?
Talking with Navision: Exposing .NET Components to Navision
How to: Use the BYOT (Bring Your Own Transaction) Feature of COM+
How to use COM+ transactions in a Visual C# component (MS KB 816141)
精彩评论