BizTalk 映射 - 脚本化 Functoid 对象生命周期,何时初始化和销毁
在 BizTalk 映射中,当您调用脚本函数时,对象(您正在调用的类)是否在第一次调用时初始化并在转换发生的整个过程中保留在内存中?或者每次执行新行或每次调用脚本时都会销毁并初始化?
我之所以问这个问题,是因为我对通过脚本函数在内存中缓存一个小型查找表的优点进行了争论。我想在第一次查找第一条记录时缓存字典,并使用相同的字典而不访问数据库来进行后续查找。
这是一种天真的做法吗?字典是否会因为对象将被重新初始化而丢失,或者它会保留在内存中直到转换结束?微软对此有任何指导吗(我找不到任何指导)?
In a BizTalk map when you call a scripting functiod, is the object (the class you are calling) initialized at the time of the first call and kept in memory for the entire time the transformation is occurring? Or is is destroyed and initialized every time a new row is executed, or every time the script is called?
The reason I ask, is because I have had a debate about merits of caching a small look up table in memory, via a scripting functiod. I want to cache a dictionary the first time we do a look up on the first record, and use the same dictionary without database access for subsequent looks ups.
Is this a naive approach? Would the dictionary be lost because the object will be re-initialized, or is it kept in memory until the end of the transformation? Does Microsoft have any guidance on this (I've not been able to find any)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要它是外部组件中的非静态类,BizTalk 就会在每次映射运行时创建一个新实例,并且您所描述的“普通”缓存将起作用。
这篇文章< /a> 及其引用的帖子讨论了问题和一些不同的解决方案。
As long as it's a non-static class in an external component BizTalk will create a new instance for each time the map runs and "ordinary" caching as you describe would work.
This post and the posts it refers to discusses the problems and a few different solutions.