如何使事务流从 Navision 到为 COM 互操作注册的 C# 组件?
在我的上下文中,我涉及到 Navision,但我不知道这可能与每个 COM 互操作场景相关。
无论如何,情况: - 我有一个为 COM Interop 注册的简单 C# 组件 - 我从 Navision 调用它,就在插入新记录之前(谁知道 Navision,在“OnInsert”触发器内,因此在事务的上下文中)
我期望有一个环境事务,但是 System.Transactions.Transaction。当前为空。
我错过了什么吗? 我应该采用哪些特定技术来使事务流入我的互操作组件?
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.Transactions.Transaction.Current is null.
Am I missing something?
Are there particular techniques I should adopt to make the transaction flow into my interop component?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试在 NAV 中开始事务,然后使用 COM 对象访问该事务?
听起来 System.Transactions.Transaction.Current 值为 null,因为您尚未在 COM 对象中初始化事务 - 您可以发布它的代码示例吗?
尽管从您的帖子来看,您似乎期望 Transaction.Current 值指的是您在 NAV 中发起的交易,但我认为这不会发生,甚至是可能的!
您的 COM 对象试图对事务执行什么操作?也许我们可以采取不同的方法?
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?
与 Navision 交谈:向 Navision 公开 .NET 组件
如何:使用 COM+ 的 BYOT(自带事务)功能
如何在 Visual C# 组件中使用 COM+ 事务 (MS KB 816141)
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)