How can you serialize an empty DataTable to Session? RRS feed

  • Question

  • ASP.NET 2.x, C#.  I store a DataSet in Session.  It has some empty DataTables (i.e. no rows).

    All works fine when Session is in-process.  But when Session is out-of-process (SQL Server in my case), I lose any empty DataTables --- either on Serialize or Deserialize (don't know which).  I'm guessing serialization is "clever", and doesn't store DataTable till it sees a row in it, even though I have marked that I want schema included in Serialization.

    Is there any way I can convince .NET not to try to be so "clever", and store/restore my table with schema as part of the DataSet, even though it has no rows?
    Monday, May 11, 2009 11:47 AM