2003-02-05 Alan Tam <Tam@suiLung.com>
authorVille Palo <ville@mono-cvs.ximian.com>
Wed, 5 Feb 2003 15:48:57 +0000 (15:48 -0000)
committerVille Palo <ville@mono-cvs.ximian.com>
Wed, 5 Feb 2003 15:48:57 +0000 (15:48 -0000)
* DataSet.cs: Added framework for DataSet.Update Implemented missing
methods GetSchemaSerializable, GetSerializationData,
ReadXmlSerializable, ShouldSerializeRelations and ShouldSerializeTables
for DataSet
* DataTable.cs: Implemented missing methods CreateInstance and
GetRowType for DataTable

svn path=/trunk/mcs/; revision=11244

mcs/class/System.Data/System.Data/ChangeLog
mcs/class/System.Data/System.Data/DataSet.cs
mcs/class/System.Data/System.Data/DataTable.cs

index 3e2c4e3c0ffb17e2f3648c7c367d80a654728111..3a7ece3c5578147db7ece042c03c8f58be9acaa6 100644 (file)
@@ -1,3 +1,12 @@
+2003-02-05  Alan Tam <Tam@suiLung.com>\r
+\r
+       * DataSet.cs: Added framework for DataSet.Update Implemented missing \r
+       methods GetSchemaSerializable, GetSerializationData, \r
+       ReadXmlSerializable, ShouldSerializeRelations and ShouldSerializeTables\r
+       for DataSet\r
+       * DataTable.cs: Implemented missing methods CreateInstance and \r
+       GetRowType for DataTable\r
+       \r
 2003-02-03  Ville Palo <vi64pa@koti.soon.fi>\r
 \r
        * DataSet.cs: Implemented private method MapType for \r
index 6ceb3b2b456d6f905b01626a12fa4a164a69b03c..1b536c0c4301e65da4362eaef2c0dcba864aada7 100644 (file)
@@ -40,6 +40,7 @@ namespace System.Data {
                // private DataTableRelationCollection relationCollection;
                private PropertyCollection properties;
                private DataViewManager defaultView;
+               private CultureInfo locale;
                
                #region Constructors
 
@@ -116,17 +117,60 @@ namespace System.Data {
                [DataCategory ("Data")]
                [DataSysDescription ("Indicates a locale under which to compare strings within the DataSet.")]
                public CultureInfo Locale {
-                       [MonoTODO]
-                       get { 
-                               throw new NotImplementedException ();
+                       get {
+                               return locale;
                        }
-                       
-                       [MonoTODO]
                        set {
-                               throw new NotImplementedException ();
+                               if (locale == null || !locale.Equals(value)) {
+                                       // TODO: check if the new locale is valid
+                                       // TODO: update locale of all tables
+                                       locale = value;
+                               }
                        }
                }
 
+               [MonoTODO]
+               public void Merge (DataRow[] rows)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               [MonoTODO]
+               public void Merge (DataSet dataSet)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               [MonoTODO]
+               public void Merge (DataTable table)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               [MonoTODO]
+               public void Merge (DataSet dataSet, bool preserveChanges)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               [MonoTODO]
+               public void Merge (DataRow[] rows, bool preserveChanges, MissingSchemaAction missingSchemaAction)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               [MonoTODO]
+               public void Merge (DataSet dataSet, bool preserveChanges, MissingSchemaAction missingSchemaAction)
+               {
+                       throw new NotImplementedException();
+               }
+               
+               [MonoTODO]
+               public void Merge (DataTable table, bool preserveChanges, MissingSchemaAction missingSchemaAction)
+               {
+                       throw new NotImplementedException();
+               }
+               
                [DataCategory ("Data")]
                [DataSysDescription ("Indicates the XML uri namespace for the root element pointed at by this DataSet.")]
                [DefaultValue ("")]
@@ -554,6 +598,34 @@ namespace System.Data {
                }
                #endregion
                
+               #region Protected Methods
+               protected virtual void GetSerializationData(SerializationInfo info, StreamingContext context)
+               {
+                       string s = info.GetValue ("XmlDiffGram", typeof (String)) as String;
+                       if (s != null) ReadXmlSerializable (new XmlTextReader(new StringReader(s)));
+               }
+               
+               protected virtual System.Xml.Schema.XmlSchema GetSchemaSerializable()
+               {
+                       return null; // FIXME
+               }
+               
+               protected virtual void ReadXmlSerializable(XmlReader reader)
+               {
+                       ReadXml(reader, XmlReadMode.DiffGram); // FIXME
+               }
+               
+               protected virtual bool ShouldSerializeRelations ()
+               {
+                       return true;
+               }
+               
+               protected virtual bool ShouldSerializeTables ()
+               {
+                       return true;
+               }
+               #endregion
+
                #region Private Xml Serialisation
        
                private void WriteTable( XmlWriter writer, DataTable table, XmlWriteMode mode )
index 5e772881932a5e2e1130e6c01eb2fb050b10771e..313756dfa7dfeef2b25075cb6816e121f4368d72 100644 (file)
@@ -555,9 +555,20 @@ namespace System.Data {
                /// and is not intended to be used directly from your code.
                /// </summary>
                
-               //protected virtual Type GetRowType()
-               //{     
-               //}
+               protected virtual DataTable CreateInstance()
+               {
+                        return Activator.CreateInstance(this.GetType(), true) as DataTable;
+               }
+
+               /// <summary>
+               /// This member supports the .NET Framework infrastructure
+               /// and is not intended to be used directly from your code.
+               /// </summary>
+               
+               protected virtual Type GetRowType()
+               {
+                        return typeof (DataRow);
+               }
 
                /// <summary>
                /// This member supports the .NET Framework infrastructure