问题
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
回答1:
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
来源:https://stackoverflow.com/questions/13665915/does-reportviewer-run-in-a-separate-appdomain