dbTalk Databases Forums  

CellSetGrid - Serializes ADOMDConnection, which is not serializable

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss CellSetGrid - Serializes ADOMDConnection, which is not serializable in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
DoHMaN
 
Posts: n/a

Default CellSetGrid - Serializes ADOMDConnection, which is not serializable - 07-24-2006 , 07:19 AM






In web.config,
<sessionState mode="InProc"
works, because asp doesn't actually serialize the session when set to
InProc

however, if you switch your session state to either
<sessionState mode="StateServer"

or
<sessionState mode="Custom"

ASP throws:
Unable to serialize the session state. In 'StateServer' and 'SQLServer'
mode, ASP.NET will serialize the session state objects, and as a result
non-serializable objects or MarshalByRef objects are not permitted. The
same restriction applies if similar serialization is done by the custom
session state store in 'Custom' mode.

[SerializationException: Type
'Microsoft.AnalysisServices.AdomdClient.AdomdConne ction' in Assembly
'Microsoft.AnalysisServices.AdomdClient, Version=9.0.242.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' is not marked as
serializable.]


in CellSetGrid.cs:

private adomdp.AdomdConnection _oCon;
private Microsoft.AnalysisServices.AdomdClient.AdomdConnec tion oCon
{
get
{
// Create a new connection if there isn't one cached
if (_oCon==null ) _oCon =
(adomdp.AdomdConnection)HttpContext.Current.Sessio n[this.ID + "_oCon"];
return( _oCon );
}
set
{
_oCon = value;
HttpContext.Current.Session.Add(this.ID + "_oCon",_oCon);
}
}


now from what I understand in the MSDN - this is as designed, the
connection will pool and not actually close when the object goes out of
scope... so a request for an identical connection will retain the old
one.

Am I missing something?

- Lawren


Reply With Quote
  #2  
Old   
Jéjé
 
Posts: n/a

Default Re: CellSetGrid - Serializes ADOMDConnection, which is not serializable - 07-24-2006 , 07:32 AM






good point.

the connection cannot be serialized.
the code should be changed to store only the sessionid of the connection,
not the entire connection.

the session still open on the server until we calll the .Close() function
with "True" as parameter (True = close the session)

when you open the connection again, reuse the saved sessionid, if an error
is raised, clear the sessionid and reopen a complete new session.
the sessionid can be retrieved after you open a connection to the server.

"DoHMaN" <slogeco (AT) msn (DOT) com> wrote

Quote:
In web.config,
sessionState mode="InProc"
works, because asp doesn't actually serialize the session when set to
InProc

however, if you switch your session state to either
sessionState mode="StateServer"

or
sessionState mode="Custom"

ASP throws:
Unable to serialize the session state. In 'StateServer' and 'SQLServer'
mode, ASP.NET will serialize the session state objects, and as a result
non-serializable objects or MarshalByRef objects are not permitted. The
same restriction applies if similar serialization is done by the custom
session state store in 'Custom' mode.

[SerializationException: Type
'Microsoft.AnalysisServices.AdomdClient.AdomdConne ction' in Assembly
'Microsoft.AnalysisServices.AdomdClient, Version=9.0.242.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' is not marked as
serializable.]


in CellSetGrid.cs:

private adomdp.AdomdConnection _oCon;
private Microsoft.AnalysisServices.AdomdClient.AdomdConnec tion oCon
{
get
{
// Create a new connection if there isn't one cached
if (_oCon==null ) _oCon =
(adomdp.AdomdConnection)HttpContext.Current.Sessio n[this.ID + "_oCon"];
return( _oCon );
}
set
{
_oCon = value;
HttpContext.Current.Session.Add(this.ID + "_oCon",_oCon);
}
}


now from what I understand in the MSDN - this is as designed, the
connection will pool and not actually close when the object goes out of
scope... so a request for an identical connection will retain the old
one.

Am I missing something?

- Lawren




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.