internal void DeserializeTableSchema(SerializationInfo info, StreamingContext context, bool isSingleTable)
{
//DataTable basic properties
_tableName = info.GetString("DataTable.TableName");
_tableNamespace = info.GetString("DataTable.Namespace");
_tablePrefix = info.GetString("DataTable.Prefix");
bool caseSensitive = info.GetBoolean("DataTable.CaseSensitive");
SetCaseSensitiveValue(caseSensitive, true, false);
_caseSensitiveUserSet = !info.GetBoolean("DataTable.caseSensitiveAmbient");
int lcid = (int)info.GetValue("DataTable.LocaleLCID", typeof(int));
CultureInfo culture = new CultureInfo(lcid);
SetLocaleValue(culture, true, false);
_cultureUserSet = true;
MinimumCapacity = info.GetInt32("DataTable.MinimumCapacity");
//DataTable state internal properties
_fNestedInDataset = info.GetBoolean("DataTable.NestedInDataSet");
string tName = info.GetString("DataTable.TypeName");
_typeName = new XmlQualifiedName(tName);
_repeatableElement = info.GetBoolean("DataTable.RepeatableElement");
//ExtendedProperties
_extendedProperties = (PropertyCollection)info.GetValue("DataTable.ExtendedProperties", typeof(PropertyCollection));
//Columns
int colCount = info.GetInt32("DataTable.Columns.Count");
string[] expressions = new string[colCount];
Debug.Assert(Columns.Count == 0, "There is column in Table");
IFormatProvider formatProvider = CultureInfo.InvariantCulture;
for (int i = 0; i < colCount; i++)
{
DataColumn dc = new DataColumn();
//DataColumn public state properties
dc.ColumnName = info.GetString(string.Format(formatProvider, "DataTable.DataColumn_{0}.ColumnName", i));
dc._columnUri = info.GetString(string.Format(formatProvider, "DataTable.DataColumn_{0}.Namespace", i));
dc.Prefix = info.GetString(string.Format(formatProvider, "DataTable.DataColumn_{0}.Prefix", i));
dc.DataType = (Type)info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.DataType", i), typeof(Type));
dc.XmlDataType = (string)info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.XmlDataType", i), typeof(string));
dc.SimpleType = (SimpleType)info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.SimpleType", i), typeof(SimpleType));
dc.ColumnMapping = (MappingType)info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.ColumnMapping", i), typeof(MappingType));
dc.DateTimeMode = (DataSetDateTime)info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.DateTimeMode", i), typeof(DataSetDateTime));
dc.AllowDBNull = info.GetBoolean(string.Format(formatProvider, "DataTable.DataColumn_{0}.AllowDBNull", i));
dc.AutoIncrement = info.GetBoolean(string.Format(formatProvider, "DataTable.DataColumn_{0}.AutoIncrement", i));
dc.AutoIncrementStep = info.GetInt64(string.Format(formatProvider, "DataTable.DataColumn_{0}.AutoIncrementStep", i));
dc.AutoIncrementSeed = info.GetInt64(string.Format(formatProvider, "DataTable.DataColumn_{0}.AutoIncrementSeed", i));
dc.Caption = info.GetString(string.Format(formatProvider, "DataTable.DataColumn_{0}.Caption", i));
dc.DefaultValue = info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.DefaultValue", i), typeof(object));
dc.ReadOnly = info.GetBoolean(string.Format(formatProvider, "DataTable.DataColumn_{0}.ReadOnly", i));
dc.MaxLength = info.GetInt32(string.Format(formatProvider, "DataTable.DataColumn_{0}.MaxLength", i));
//DataColumn internal state properties
dc.AutoIncrementCurrent = info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.AutoIncrementCurrent", i), typeof(object));
//Expression
if (isSingleTable)
{
expressions[i] = info.GetString(string.Format(formatProvider, "DataTable.DataColumn_{0}.Expression", i));
}
//ExtendedProperties
dc._extendedProperties = (PropertyCollection)info.GetValue(string.Format(formatProvider, "DataTable.DataColumn_{0}.ExtendedProperties", i), typeof(PropertyCollection));
Columns.Add(dc);
}
if (isSingleTable)
{
for (int i = 0; i < colCount; i++)
{
if (expressions[i] != null)
{
Columns[i].Expression = expressions[i];
}
}
}
//Constraints
if (isSingleTable)
{
DeserializeConstraints(info, context, /*table index */ 0, /* serialize all constraints */false);// since single table, send table index as 0, meanwhile passing
// false for 'allConstraints' means, handle all the constraint related to the table
}
}