I'm not sure I get what you mean..
In my data access layer I use the ADO factory to make a Firebird data access layer, with two methods. One to open a query and one for insert/update(/delete) queries. An implementation could look like this:
// get a data access layer manager that holds a DAL for each database provider I use
DataAccessLayerManager dal = DataAccessLayerManager.GetDAL();
// eventCollection would be a Component in the Composite pattern
EventCollection eventCollection = new EventCollection();
// doing a batch select, so don't close connection between queries
dal.CloseConnectionAfterQuery = false;
// get the SQL (named GetEvents) from an XML file, create a parameter that can convert to a provider specific parameter
// and return a DataTable with the results
DataTable eventsTable = dal.OpenQuery("GetEvents",
    Parameter.GetParameter("UserID", 1, DbType.Int32, ParameterDirection.Input));
// creating an Event object (Event would be a Composite in the Composite pattern) for each row in the DataTable
foreach (DataRow row in eventsTable.Rows)
{
   int? id = new Nullable<int>(Convert.ToInt32(row["event_id"]));
   string name = row["product"].ToString();
   DateTime? start = new Nullable<DateTime>( Convert.ToDateTime(row["date_start"]));
   DateTime? end = new Nullable<DateTime>(Convert.ToDateTime(row["date_end"]));
   string desc = row["description"].ToString();
   bool? bookable = new Nullable<bool>(( Convert.IsDBNull(row["Bookable"]) ? false : true));
   Event Event(id, name, start, end, desc, bookable);
// add the Event to the collection
   eventcollection.AddComponent(oneEvent);
}
dal.CloseConnectionAfterQuery = true;

Now wouldn't it be great if the DAL had a method called BatchSelect?

On 11/1/06, Jiri Cincura < [EMAIL PROTECTED]> wrote:
Jon Ege Ronnenberg wrote:
> My motivation is that I develop an ASP.NET <http://ASP.NET> solution and
> almost all my buisness logic is structured as a Composite pattern. That
> means that I make a lot of select queries to the database (one for each
> class and subclass). While I don't close the connection between these
> request (that cut the request time down by a factor of 3) I still feel
> it should be tuned a little. Batch select is the most obvious one.

Why not to use typed DataSet with more DataTables?

--
Jiri {x2} Cincura
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to