如何使事务流从 Navision 到为 COM 互操作注册的 C# 组件?

发布于 2024-08-06 19:01:03 字数 275 浏览 4 评论 0原文

在我的上下文中,我涉及到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放我走吧 2024-08-13 19:01:03

您是否尝试在 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文