Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Another SessionState Question
Message
De
15/03/2003 17:35:52
 
 
À
14/03/2003 00:24:40
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00765224
Message ID:
00766241
Vues:
17
And yet one more update ... I have found the problem with our sub-classed Typed DataSets. A guy on the www.asp.net forums pointed out that I needed to have an additional constructor in my sub-class as follows:
public MyTypedDataSet(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
Once I added that everything now works fine and I don't have to bother with the DiffGram workaround. Much better!!

~~Bonnie

>In case anyone is interested in this thread, I have an update on the situation. It appears that the problem is *not* with Typed DataSets, but we further sub-class the auto-generated Typed DataSets and it's our sub-classes that refuse to de-serialize (not sure why, they should be fine and work in all other situations). But, rather than try to figure out why, I decided on the workaround that I mentioned earlier with a slight adjustment. I'm serializing the DataSet to a DiffGram and saving that to the Session variable. It works fine and preserves any changes to the DataSet.
>
>So, FYI ....
>
>~~Bonnie
>
>
>>I'm getting different behavior when saving a DataSet to SessionState ... differences between using the default in-process Session vs saving Session to SQL Server.
>>
>>When using a regular DataSet, all seems to work just fine. But, when using a Typed DataSet (which all our DataSets are), it doesn't work for SQL Sessions but works fine for the in-memory Sessions. Any idea why? I get an error about deserializing the DataSet.
>>
>>Here's how I was doing this (where this.oData is a Typed DataSet):
>>
>>// to save to Session
>>Session["oData"] = this.oData;
>>
>>// to retrieve from Session
>>this.oData = (MyDataSet)Session["oData"];
>>
>>
>>I've worked around it for now by serializing the DataSet to XML and saving the XML string as the Session variable and then getting it back into the DataSet with ReadXML() (but I may run into other problems with that ... not sure yet how this will affect deleted rows ... I'm still researching this).
>>
>>Anyone know why the behavior is different? Why should it not work just because I'm saving the Session variable to SQL? Anything else I need to do differently?
>>
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform