[Mono-list] Compilation Errors on DataSet Classes Generated byXSD.exe
Alan Tam
Tam@SiuLung.com
Wed, 5 Feb 2003 23:19:28 +0800
This is a multi-part message in MIME format.
------=_NextPart_000_0018_01C2CD6D.08144270
Content-Type: text/plain;
charset="big5"
Content-Transfer-Encoding: 7bit
Attached please find a patch for mcs/class/System.Data/System.Data/
and a new file for mcs/class/System/System.ComponentModel/
Suggested ChangeLog for mcs/class/System.Data/System.Data/:
Added framework for DataSet.Update
Implemented missing methods GetSchemaSerializable, GetSerializationData,
ReadXmlSerializable, ShouldSerializeRelations and ShouldSerializeTables for
DataSet
Implemented missing methods CreateInstance and GetRowType for DataTable
Suggested ChangeLog for mcs/class/System/System.ComponentModel/:
Implemented DesignerCategoryAttribute
Regards,
Alan
----- Original Message -----
From: "Miguel de Icaza" <miguel@ximian.com>
To: "Alan Tam" <Tam@SiuLung.com>
Cc: "Mono-List" <mono-list@ximian.com>
Sent: Wednesday, February 05, 2003 2:36 AM
Subject: Re: [Mono-list] Compilation Errors on DataSet Classes Generated
byXSD.exe
> Hello,
>
> > I've tried to generate a class from XSD.exe by Microsoft and compile it in
> > Mono. There are many compilation errors and I have to at least patch it
like
> > this in order to make it work.
>
> Please post your patches in diff -u form, and also explain what the
> patch does in a ChangeLog entry.
>
> Removing functionality is usually not a good idea. It might be best to
> just implement the missing classes.
>
> Miguel
> _______________________________________________
> Mono-list maillist - Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
------=_NextPart_000_0018_01C2CD6D.08144270
Content-Type: application/octet-stream;
name="System.Data.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="System.Data.patch"
Index: DataSet.cs=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mcs/class/System.Data/System.Data/DataSet.cs,v=0A=
retrieving revision 1.32=0A=
diff -u -r1.32 DataSet.cs=0A=
--- DataSet.cs 3 Feb 2003 19:04:16 -0000 1.32=0A=
+++ DataSet.cs 5 Feb 2003 15:01:59 -0000=0A=
@@ -40,6 +40,7 @@=0A=
// private DataTableRelationCollection relationCollection;=0A=
private PropertyCollection properties;=0A=
private DataViewManager defaultView;=0A=
+ private CultureInfo locale;=0A=
=0A=
#region Constructors=0A=
=0A=
@@ -116,17 +117,60 @@=0A=
[DataCategory ("Data")]=0A=
[DataSysDescription ("Indicates a locale under which to compare =
strings within the DataSet.")]=0A=
public CultureInfo Locale {=0A=
- [MonoTODO]=0A=
- get { =0A=
- throw new NotImplementedException ();=0A=
+ get {=0A=
+ return locale;=0A=
}=0A=
- =0A=
- [MonoTODO]=0A=
set {=0A=
- throw new NotImplementedException ();=0A=
+ if (locale =3D=3D null || !locale.Equals(value)) {=0A=
+ // TODO: check if the new locale is valid=0A=
+ // TODO: update locale of all tables=0A=
+ locale =3D value;=0A=
+ }=0A=
}=0A=
}=0A=
=0A=
+ [MonoTODO]=0A=
+ public void Merge (DataRow[] rows)=0A=
+ {=0A=
+ throw new NotImplementedException();=0A=
+ }=0A=
+ =0A=
+ [MonoTODO]=0A=
+ public void Merge (DataSet dataSet)=0A=
+ {=0A=
+ throw new NotImplementedException();=0A=
+ }=0A=
+ =0A=
+ [MonoTODO]=0A=
+ public void Merge (DataTable table)=0A=
+ {=0A=
+ throw new NotImplementedException();=0A=
+ }=0A=
+ =0A=
+ [MonoTODO]=0A=
+ public void Merge (DataSet dataSet, bool preserveChanges)=0A=
+ {=0A=
+ throw new NotImplementedException();=0A=
+ }=0A=
+ =0A=
+ [MonoTODO]=0A=
+ public void Merge (DataRow[] rows, bool preserveChanges, =
MissingSchemaAction missingSchemaAction)=0A=
+ {=0A=
+ throw new NotImplementedException();=0A=
+ }=0A=
+ =0A=
+ [MonoTODO]=0A=
+ public void Merge (DataSet dataSet, bool preserveChanges, =
MissingSchemaAction missingSchemaAction)=0A=
+ {=0A=
+ throw new NotImplementedException();=0A=
+ }=0A=
+ =0A=
+ [MonoTODO]=0A=
+ public void Merge (DataTable table, bool preserveChanges, =
MissingSchemaAction missingSchemaAction)=0A=
+ {=0A=
+ throw new NotImplementedException();=0A=
+ }=0A=
+ =0A=
[DataCategory ("Data")]=0A=
[DataSysDescription ("Indicates the XML uri namespace for the root =
element pointed at by this DataSet.")]=0A=
[DefaultValue ("")]=0A=
@@ -554,6 +598,34 @@=0A=
}=0A=
#endregion=0A=
=0A=
+ #region Protected Methods=0A=
+ protected virtual void GetSerializationData(SerializationInfo info, =
StreamingContext context)=0A=
+ {=0A=
+ string s =3D info.GetValue ("XmlDiffGram", typeof (String)) as =
String;=0A=
+ if (s !=3D null) ReadXmlSerializable (new XmlTextReader(new =
StringReader(s)));=0A=
+ }=0A=
+ =0A=
+ protected virtual System.Xml.Schema.XmlSchema GetSchemaSerializable()=0A=
+ {=0A=
+ return null; // FIXME=0A=
+ }=0A=
+ =0A=
+ protected virtual void ReadXmlSerializable(XmlReader reader)=0A=
+ {=0A=
+ ReadXml(reader, XmlReadMode.DiffGram); // FIXME=0A=
+ }=0A=
+ =0A=
+ protected virtual bool ShouldSerializeRelations ()=0A=
+ {=0A=
+ return true;=0A=
+ }=0A=
+ =0A=
+ protected virtual bool ShouldSerializeTables ()=0A=
+ {=0A=
+ return true;=0A=
+ }=0A=
+ #endregion=0A=
+=0A=
#region Private Xml Serialisation=0A=
=0A=
private void WriteTable( XmlWriter writer, DataTable table, =
XmlWriteMode mode )=0A=
Index: DataTable.cs=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /mono/mcs/class/System.Data/System.Data/DataTable.cs,v=0A=
retrieving revision 1.27=0A=
diff -u -r1.27 DataTable.cs=0A=
--- DataTable.cs 30 Jan 2003 16:24:39 -0000 1.27=0A=
+++ DataTable.cs 5 Feb 2003 15:02:00 -0000=0A=
@@ -555,9 +555,20 @@=0A=
/// and is not intended to be used directly from your code.=0A=
/// </summary>=0A=
=0A=
- //protected virtual Type GetRowType()=0A=
- //{ =0A=
- //}=0A=
+ protected virtual DataTable CreateInstance()=0A=
+ {=0A=
+ return Activator.CreateInstance(this.GetType(), =
true) as DataTable;=0A=
+ }=0A=
+=0A=
+ /// <summary>=0A=
+ /// This member supports the .NET Framework infrastructure=0A=
+ /// and is not intended to be used directly from your code.=0A=
+ /// </summary>=0A=
+ =0A=
+ protected virtual Type GetRowType()=0A=
+ {=0A=
+ return typeof (DataRow);=0A=
+ }=0A=
=0A=
/// <summary>=0A=
/// This member supports the .NET Framework infrastructure =0A=
------=_NextPart_000_0018_01C2CD6D.08144270
Content-Type: text/plain;
name="DesignerCategoryAttribute.cs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="DesignerCategoryAttribute.cs"
//=0A=
// System.ComponentModel.DesignerCategoryAttribute.cs=0A=
//=0A=
// Author:=0A=
// Alan Tam Siu Lung (Tam@SiuLung.com)=0A=
//=0A=
=0A=
namespace System.ComponentModel {=0A=
=0A=
/// <summary>=0A=
/// Designer Attribute for classes.=0A=
/// </summary>=0A=
=0A=
/// <remarks>=0A=
/// </remarks>=0A=
=0A=
[AttributeUsage(AttributeTargets.Class)]=0A=
public sealed class DesignerCategoryAttribute : Attribute=0A=
{=0A=
string category;=0A=
public static readonly DesignerCategoryAttribute Component;=0A=
public static readonly DesignerCategoryAttribute Form;=0A=
public static readonly DesignerCategoryAttribute Generic;=0A=
static readonly DesignerCategoryAttribute Default;=0A=
=0A=
public DesignerCategoryAttribute ()=0A=
{=0A=
this.category =3D "";=0A=
}=0A=
=0A=
public DesignerCategoryAttribute (string category)=0A=
{=0A=
this.category =3D category;=0A=
}=0A=
=0A=
public override object TypeId {=0A=
get {=0A=
return GetType ();=0A=
}=0A=
}=0A=
=0A=
public string Category {=0A=
get {=0A=
return category;=0A=
}=0A=
}=0A=
=0A=
public override bool Equals (object obj)=0A=
{=0A=
if (!(obj is DesignerCategoryAttribute))=0A=
return false;=0A=
if (obj =3D=3D this)=0A=
return true;=0A=
return ((DesignerCategoryAttribute) obj).category =3D=3D category;=0A=
}=0A=
=0A=
public override int GetHashCode ()=0A=
{=0A=
return category.GetHashCode ();=0A=
}=0A=
=0A=
public override bool IsDefaultAttribute ()=0A=
{=0A=
return category =3D=3D DesignerCategoryAttribute.Default.Category; =
// FIXME=0A=
}=0A=
}=0A=
}=0A=
------=_NextPart_000_0018_01C2CD6D.08144270--