PC Review


Reply
Thread Tools Rate Thread

Data Access "Architecture" question

 
 
Fresno Bob
Guest
Posts: n/a
 
      2nd Sep 2008
Hi I'm creating a data access layer in which each object maps onto a
database table. I will also be creating basic methods that return the object
by primaryid and perform insert and update operations. I also will be
creating methods which return collections of the object. Where should I put
those methods that return collections of objects. Should I create a
Collections class that corresponds with each object which just returns
collections.

Bear in mind I am using CodeSmith and so would like a consistant place to
put the main object with it's properties and so forth and the methods that
will return collections.

Regards, Chris.


 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      3rd Sep 2008
Wow, you sure opened a can of worms. :-)

The pattern you are talking about is Active Record. In general, you put the
active record classes down near your DAL and use a provider model to
separate out different types of access. I say, in general, as I am sure
someone else has solved the problem in a different way.

One open source project you might look at is SubSonic. It will generate
Active Record classes and it uses providers to keep the physical storage
(SQL Server, Access, etc.) separate from the classes. Whether you opt to
stick with it, it might give you clues for CodeSmith.

As for the collection "problem", with an Active Record model, you are
probably best to choose to have a collection per object type. It keeps
everything one to one. You could opt for a generic implemntation, but you
really have to think that one out.

Be sure to use partial classes, as you will find reasons to extend your
generated classes at some time.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Fresno Bob" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi I'm creating a data access layer in which each object maps onto a
> database table. I will also be creating basic methods that return the
> object by primaryid and perform insert and update operations. I also will
> be creating methods which return collections of the object. Where should I
> put those methods that return collections of objects. Should I create a
> Collections class that corresponds with each object which just returns
> collections.
>
> Bear in mind I am using CodeSmith and so would like a consistant place to
> put the main object with it's properties and so forth and the methods that
> will return collections.
>
> Regards, Chris.
>
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2007 "attachment" "Data Type" not an option Shane Microsoft Access Database Table Design 2 11th Sep 2009 07:43 PM
Data Access "Architecture" question Fresno Bob Microsoft VB .NET 1 4th Sep 2008 04:31 PM
What to do to access "Local Settings" and "Application Data"? Michael Moser Windows Vista Administration 1 2nd Dec 2007 08:31 PM
create a "requery" or "new" button on data access page =?Utf-8?B?TWVnTlNhYmluZU1D?= Microsoft Access Database Table Design 0 18th May 2006 03:44 PM
Mispost "Web Application Architecture Question" should be in ASPNET arthernan@hotmail.com Microsoft ADO .NET 0 24th Feb 2006 02:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:49 PM.