Reputation: 1266
We have web based application, we used dataset to store the information. WE used to store these datasets in Sessions and get from Sessions during Ajax call and update them. At that time Session State was InProc.
Now We want to store the session data in Sql Sever, to store in session we need to make the dataset [Serializable]
I test with normal datasets it works fine, but in our case we create our DataSets by inherit from DataSet like
public class OurDataSet : DataSet
{
#constants
all the column names are used in all the tables are used as Constants.
#constructor
// add all the related tables
public OurDataSet()
{
this.Tables.Add(OurDataTable());
}
public static DataTable OurDataTable()
{
}
}
My problem is that i can not serialized this object even decorated with [Serializable] attribute.
Thanks
Upvotes: 2
Views: 759
Reputation: 1064114
DataSet
uses custom serialization (ISerializable
) - which means you need to add a supporting constructor:
protected OurDataSet(SerializationInfo information, StreamingContext context)
: base(information, context) {}
Note that the base implementation should handle all the details - you dont need to add anything. This may be in addition to a default constructor:
public OurDataSet() {}
Upvotes: 2