ReportViewer 是否在单独的 AppDomain 中运行? [英] Does ReportViewer run in a separate AppDomain?

查看:50
本文介绍了ReportViewer 是否在单独的 AppDomain 中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用本地模式下的报表查看器在 WinForms 应用程序中运行报表.我遇到的问题是,从报告中,我正在访问一个使用单例模式创建的对象;该对象在 WinForms 应用程序启动时被实例化和初始化,但报告创建了一个新实例,因为它没有看到该实例已由 WinForms 应用程序创建.

I am running a report in a WinForms application using the report viewer in Local mode. The problem I'm running into is that from the report I'm accessing an object that was created using the Singleton pattern; this object is instanciated and initialized when the WinForms application launches but the report creates a new instance because it does not see that the instance was already created by the WinForms application.

任何想法可能会发生什么?谢谢

Any ideas what could be happening? Thanks

推荐答案

在做了更多研究之后,我发现 ReportViewer 确实在单独的 AppDomain 下运行;这意味着将创建一个 Singleton 类的新实例,因为静态实例使用的内存空间是每个 AppDomain

After doing some more research I found that the ReportViewer does run under a separate AppDomain; this means that a new instance of the Singleton class will be created as the memory space used by the static instance is per AppDomain

这篇关于ReportViewer 是否在单独的 AppDomain 中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆