You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm hoping to use protobuf-net-data to replace the use of BinaryFormatter in a generic SQL caching solution. When retrieving from cache we don't know the number of tables in the DataSet. Could protobuf-net-data be extended to support this? It already supports an arbitrary number of columns and rows.
In the nunit test below, if I pass the right number of tables to the DeserializeDataSet call it will work. I would like to not specify any tables at all.
[Test]publicvoidMultipleDataSetTest(){// GIVEN: a DataSet with multiple tablesDataSetexpected=new DataSet();DataTabledt= expected.Tables.Add("Table1");
dt.Columns.Add(new DataColumn("column1",typeof(int)));
dt.Columns.Add(new DataColumn("column2",typeof(double)));
dt.Rows.Add(1234,100.10);DataTabledt2= expected.Tables.Add("Table2");
dt2.Columns.Add(new DataColumn("column1",typeof(string)));
dt2.Columns.Add(new DataColumn("column2",typeof(int)));
dt2.Rows.Add("serialization",100);// WHEN: we serialize into cachevarstream=new MemoryStream();
DataSerializer.Serialize(stream, expected);
stream.Position =0;// THEN: we can deserialize the object with the same number of tablesvaractual= DataSerializer.DeserializeDataSet(stream,newList<string>{"Table1"});
Assert.AreEqual(expected.Tables.Count, actual.Tables.Count);for(vartable=0;table< expected.Tables.Count;table++){
Assert.AreEqual(expected.Tables[table].Rows.Count, actual.Tables[table].Rows.Count);
Assert.AreEqual(expected.Tables[table].Columns.Count, actual.Tables[table].Columns.Count);}}
Thanks
The text was updated successfully, but these errors were encountered:
I'm hoping to use protobuf-net-data to replace the use of BinaryFormatter in a generic SQL caching solution. When retrieving from cache we don't know the number of tables in the DataSet. Could protobuf-net-data be extended to support this? It already supports an arbitrary number of columns and rows.
In the nunit test below, if I pass the right number of tables to the DeserializeDataSet call it will work. I would like to not specify any tables at all.
Thanks
The text was updated successfully, but these errors were encountered: