[Mono-list] Abstract ADO.NET

Scott Wisniewski scottdw2@uwm.edu
26 May 2002 11:48:11 -0500

Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Speaking of ADO.Net, I started working on the
DataSet/DataRelation/Constraint stuff, but all I have so far is the
attached class, Tuple. Tuple takes an array of objects which must be
comparable (they must implement IComparable) and "aggregates" it into a
single comparable object. This allows relations and constraints to be
constructed on more than one column. More explictly it allows
multi-column data to be used as a key into an associative
order-preserving container. Its not designed to be used by client code.

I didn't write a hash function because I thought that the compiler would
provide one for me automatically. If this isn't the case let me know and
I will write one. If the compiler does provide one, some tests to
determine its fitness should probably be written because the uniformity
of its distribution will have a big impact on performance.

I started thinking about how I would implement the Relation and
Constraint classes, particularly how I would connect them to the
DataTable and DataTableCollection classes to respond to row insertion,
updates and deletes without modifying the class interface. I ended up
stopping that, however, because it was giving me a big headache.

I figured what I needed was a diagramtic reperesentation of the
relationships between the classes in the System.Data namespace that I
could have in front of me while I was programming, so I decided what I
would do is draw a uml diagram of the System.Data namespace. Then I
started thinking "why not diagram the entire .Net Framework Class
library?", but then it also dawned on me that I didn't know anything
about uml. I went and read a book on uml. As of now I've started
constructing uml diagrams (package dependancy diagrams, class diagrams,
etc) for the .Net class library. I don't have enough done to warrant
providing them to the group, but when I do, I'll tar/gzip them up and
send them out (html, postscript and pdf versions)

I figured that having diagrams of the framework library would be a big
help. Let me know if you think this is a worthwhile effort or not.

-Scott Wisniewski
On Fri, 2002-05-24 at 12:54, Daniel Morgan wrote:
> I found this interesting...
> http://abstractadonet.sourceforge.net/
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

Content-Disposition: attachment; filename=Tuple.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=Tuple.cs; charset=ISO-8859-1

// System.Data/Tuple.cs:=20=0D
//	Produces an orderable object from an array of orderable objects. This is=
 used by System.Data=0D
//	to allow for relationships and constraints involving multiple columns wi=
thin a table. For the purposes of the=0D
//	Tuple class, an object is orderable if it implements ICompareable=0D
// Author:=0D
//   Scott Wisniewski (scottdw2@uwm.edu)=0D
// (C) 2002 Scott Wisniewski=0D
namespace System.Data=20=0D
	public class Tuple : IComparable=0D
		private object[] Data_;=0D
		public Tuple(object[] Data)=20=0D
			Data_ =3D Data;=0D
		public int CompareTo(object obj)=20=0D
			if (obj !=3D null)=20=0D
				int CompValue =3D 0;=0D
				Tuple t =3D (Tuple)(obj);=0D
				for (int i =3D 0; CompValue =3D=3D 0 && i < Data_.Length && i < t.Data_=
.Length; ++i)=20=0D
					CompValue =3D  ((IComparable)(this.Data_[i])).CompareTo(t.Data_[i]);=0D
				return CompValue;=0D
				//This object must be greater than null at all times, by definition...=0D
				return 1;=0D