|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataTable Type getting lost by SerializationI have been storing a typed dataset with typed datatables using InProc
session successfully. I recently started trying to use StateServer session, which serializes objects instead of just storing them in memory. Now, when I retrieve a dataset from the session, the types of all of the datatables is gone. They come out as DataTable instead of the type they were created as. This only affects tables that I have dynamically added to the typed dataset, the standard ones that are declared as part of the initial type retain their type. I assume that this has to do with the fact that the dataset is now being serialized, but I just do not understand why the type would get lost. When referencing the table coming out of the session, I now get cast errors. Is there anything I can do about this? When you retreive your table from Session, are you using something like
this. Ctype(Session("MyDataset"),myDataSetType) I have been storing types datasets in session for a long time using this method and have never had any problems. HTH Show quote "Harry Keck" <HarryK***@discussions.microsoft.com> wrote in message news:181A3B33-99F6-4308-B6EA-238886998A46@microsoft.com... >I have been storing a typed dataset with typed datatables using InProc > session successfully. I recently started trying to use StateServer > session, > which serializes objects instead of just storing them in memory. > > Now, when I retrieve a dataset from the session, the types of all of the > datatables is gone. They come out as DataTable instead of the type they > were > created as. This only affects tables that I have dynamically added to the > typed dataset, the standard ones that are declared as part of the initial > type retain their type. > > I assume that this has to do with the fact that the dataset is now being > serialized, but I just do not understand why the type would get lost. > When > referencing the table coming out of the session, I now get cast errors. > Is > there anything I can do about this? The dataset itself comes out as the correct type. The problem is with the
tables. If my typed dataset has 3 tables defined as part of the type, when I pull the dataset out of the session, it still has those 3 tables with the correct type. But, before I put it in the session, I make a copy of one of the tables and add it to the dataset. That table comes out of the session as a DataTable, not the correct type. I can use Visual Studio to debug the code and see what the type is. This only happens with StateServer session. InProc returns the correct types. BTW, this is framework 1.1. If anyone knows that this was fixed in 2.0, please let me know. Show quote "OHM" wrote: > When you retreive your table from Session, are you using something like > this. > > Ctype(Session("MyDataset"),myDataSetType) > > I have been storing types datasets in session for a long time using this > method and have never had any problems. > > HTH > > -- > OHM > http://TrainingOn.net > > > "Harry Keck" <HarryK***@discussions.microsoft.com> wrote in message > news:181A3B33-99F6-4308-B6EA-238886998A46@microsoft.com... > >I have been storing a typed dataset with typed datatables using InProc > > session successfully. I recently started trying to use StateServer > > session, > > which serializes objects instead of just storing them in memory. > > > > Now, when I retrieve a dataset from the session, the types of all of the > > datatables is gone. They come out as DataTable instead of the type they > > were > > created as. This only affects tables that I have dynamically added to the > > typed dataset, the standard ones that are declared as part of the initial > > type retain their type. > > > > I assume that this has to do with the fact that the dataset is now being > > serialized, but I just do not understand why the type would get lost. > > When > > referencing the table coming out of the session, I now get cast errors. > > Is > > there anything I can do about this? > > > Sure have not seen this before !
Show quote "Harry Keck" <HarryK***@discussions.microsoft.com> wrote in message news:39EB1397-C8B4-4A40-B8EC-E6AFBEB832AA@microsoft.com... > The dataset itself comes out as the correct type. The problem is with the > tables. If my typed dataset has 3 tables defined as part of the type, > when I > pull the dataset out of the session, it still has those 3 tables with the > correct type. But, before I put it in the session, I make a copy of one > of > the tables and add it to the dataset. That table comes out of the session > as > a DataTable, not the correct type. I can use Visual Studio to debug the > code > and see what the type is. This only happens with StateServer session. > InProc returns the correct types. > > BTW, this is framework 1.1. If anyone knows that this was fixed in 2.0, > please let me know. > > "OHM" wrote: > >> When you retreive your table from Session, are you using something like >> this. >> >> Ctype(Session("MyDataset"),myDataSetType) >> >> I have been storing types datasets in session for a long time using this >> method and have never had any problems. >> >> HTH >> >> -- >> OHM >> http://TrainingOn.net >> >> >> "Harry Keck" <HarryK***@discussions.microsoft.com> wrote in message >> news:181A3B33-99F6-4308-B6EA-238886998A46@microsoft.com... >> >I have been storing a typed dataset with typed datatables using InProc >> > session successfully. I recently started trying to use StateServer >> > session, >> > which serializes objects instead of just storing them in memory. >> > >> > Now, when I retrieve a dataset from the session, the types of all of >> > the >> > datatables is gone. They come out as DataTable instead of the type >> > they >> > were >> > created as. This only affects tables that I have dynamically added to >> > the >> > typed dataset, the standard ones that are declared as part of the >> > initial >> > type retain their type. >> > >> > I assume that this has to do with the fact that the dataset is now >> > being >> > serialized, but I just do not understand why the type would get lost. >> > When >> > referencing the table coming out of the session, I now get cast errors. >> > Is >> > there anything I can do about this? >> >> >> Just for the record, I have now tried this on a .Net 2.0 web project, and
suffer the same results. Anybody out there know of a workaround for this? I can't be the only person to have run into this issue. Show quote "Harry Keck" wrote: > The dataset itself comes out as the correct type. The problem is with the > tables. If my typed dataset has 3 tables defined as part of the type, when I > pull the dataset out of the session, it still has those 3 tables with the > correct type. But, before I put it in the session, I make a copy of one of > the tables and add it to the dataset. That table comes out of the session as > a DataTable, not the correct type. I can use Visual Studio to debug the code > and see what the type is. This only happens with StateServer session. > InProc returns the correct types. > > BTW, this is framework 1.1. If anyone knows that this was fixed in 2.0, > please let me know. > > "OHM" wrote: > > > When you retreive your table from Session, are you using something like > > this. > > > > Ctype(Session("MyDataset"),myDataSetType) > > > > I have been storing types datasets in session for a long time using this > > method and have never had any problems. > > > > HTH > > > > -- > > OHM > > http://TrainingOn.net > > > > > > "Harry Keck" <HarryK***@discussions.microsoft.com> wrote in message > > news:181A3B33-99F6-4308-B6EA-238886998A46@microsoft.com... > > >I have been storing a typed dataset with typed datatables using InProc > > > session successfully. I recently started trying to use StateServer > > > session, > > > which serializes objects instead of just storing them in memory. > > > > > > Now, when I retrieve a dataset from the session, the types of all of the > > > datatables is gone. They come out as DataTable instead of the type they > > > were > > > created as. This only affects tables that I have dynamically added to the > > > typed dataset, the standard ones that are declared as part of the initial > > > type retain their type. > > > > > > I assume that this has to do with the fact that the dataset is now being > > > serialized, but I just do not understand why the type would get lost. > > > When > > > referencing the table coming out of the session, I now get cast errors. > > > Is > > > there anything I can do about this? > > > > > >
Other interesting topics
|
|||||||||||||||||||||||