[英]Cleaning up unmanaged resources from Session like Crystal Report Document
My problem is that I have an ASP.Net application with crystal reports in it. 我的问题是我有一个带有水晶报表的ASP.Net应用程序。 I have to store the Crystal report's
ReportDocument
object in the session state, which is an unmanaged resource. 我必须在会话状态下存储Crystal报表的
ReportDocument
对象,该状态是非托管资源。
My question is: Will the ReportDocument
object be disposed off on Session.Abandon
or I will have to manually do it myself, and if I have to manually remove the ReportDocument
object from the session state. 我的问题是:将
ReportDocument
对象放在Session.Abandon
还是我必须自己手动处理,以及是否必须从会话状态中手动删除ReportDocument
对象。 What process should I follow, because at the Session_End
event I would not know, what was the name of the object that was stored in SessionState
, neither will be able to identify the Key
with which the ReportDocument
object is stored in the Session
. 我应该遵循什么过程,因为在
Session_End
事件中,我不知道存储在SessionState
中的对象的名称是什么,两个都无法识别在Session
存储ReportDocument
对象的Key
。
Please help... 请帮忙...
I believe that when you store the object in the session you are simply serialising a copy of the objects current state, this copy won't be holding onto any unmanaged resources, but the original object will and you can just dispose of that after you have saved it to the session. 我相信,当您将对象存储在会话中时,您只是在序列化对象的当前状态的副本,该副本将不会保留任何不受管的资源,但是原始对象将并且您可以在拥有后就可以将其处置将其保存到会话中。
EDIT 编辑
Alternatively store all your reports in one session object that is a collection with a single key. 或者,将所有报告存储在一个会话对象中,该对象是一个具有单个键的集合。 eg List reports
例如列出报告
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.