ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rodrigo Pantoja" <rodrigo.pant...@gmail.com>
Subject Composite design pattern and generics support
Date Wed, 05 Jul 2006 15:16:34 GMT

	I've seen some postings on the net regarding generic collections
support in iBATIS for .NET.  I understood from those posts that there
is at least some support in the newer versions, but I don't seem to
find it on version 1.3.  Is there a newer (unreleased/development)
version I could use or am I mistaken about version 1.3?
	On a related topic, how would you implement the loading/saving of a
Composite.  I mean composite in the GoF sense of a uniform treatment
(interface) of individual objects and compositions.  An overly
simplified version of my idea would be:

	/*Composite interface*/
	public interface IPerson {
		string Name { get; set; }
		void Add(IPerson pPerson);
	/*Individual object*/
	public class Person : IPerson {
		public string Name {
			get { return _Name; }
			set { _Name = value; }
		public void Add(IPerson pPerson) {
			throw new NotSupportedException("Call only for People.");
		private string _Name;
	public class People : IPerson {
		public string Name {
			get {
				string result = "|";
				foreach (IPerson pPerson in this) { //I've omited the
Enumerable<IPerson> implementation
					result += pPerson.Name + "|";
				return result;
			set {	throw new NotSupportedException("Call only for Person."); }
		public void Add(IPerson pPerson) {
		private IList<IPerson> _People = new List<IPerson>();
	/*Composite client interface*/
	public interface IRecording {
		int Id { get; set; }
		string Title { get; set; }
		// The following property could be assigned an object of type Person
		// if it were the case of a single artist album or an object of type
		// people in case of several artists, indeed it could be unspecified
		// as in "Various Artists" but I'm not getting into that, yet!
		IPerson Artist { get; set; }
		IList Tracks { get; set; } //I want it to be an IList<ITrack>, hence
the generics question

	The question is, how would IRecording implementations go about saving
and reading themselves to a database through iBATIS for .NET Data

Thanks a lot,
Rodrigo A. Pantoja.-

View raw message