OO development question...

B

Brad Pears

I am working on a vb.net 2005 project and I have an OO design question...

I have a form on which data on the form is made up from three related tables
in a 1->M->M situation. ie... Table 1 and Table 2 are in a 1-M relationship
and Table 2 and Table 3 are also in a one to many relationship (using a
different relationship key then table 1->table2)

I am unsure how I should develop the business classes, whether I should have
just one business class which includes collection properties to house the
two 1-M relationships or whether I should create three business classes (one
for each table) with the high level class containing one collection property
for it's 1-M relationship with the 2nd class and in the second class, also
include a collection property to house the 1-M relationship it is in with
the 3rd class...

What would be a good business class design for this type of scenario? I am
very new to OO design and just trying to get my feet wet!!

Thanks, Brad
 
G

Guest

I am unsure how I should develop the business classes, whether I
should have just one business class which includes collection
properties to house the two 1-M relationships or whether I should
create three business classes (one for each table) with the high level
class containing one collection property for it's 1-M relationship
with the 2nd class and in the second class, also include a collection
property to house the 1-M relationship it is in with the 3rd class...

You should have 3 classes, for each 1->M relationship, use a collection
to house the objects.

i.e,

Parent
Property Child as List(of Child)


Child
Property GrandChild as List(of GrandChild)


GrandChild
just a bunch of properties

your parent object - you may even want to inherit from a base object so
that you can put in generic helper functions (i.e. Save to Database,
Delete, etc.)

You should also take a look at LLBLGen Pro and Typed Datasets - LLBLGen
Pro is a OR Mapper which does this sort of mapping for you. Typed
Dataset is a VS.NET feature which does something similar but is MUCH
more primative ;-)
 
B

Brad Pears

Hi there... I am so new to OO, I am not sure what you mean by "helper"
functions in particular. What kind of a base class would I inherit from -
and where would I find one with the methods I would need - OR are you saying
that I would create my own base class to inherit from? I take it this would
have to be a VERY generic class that would just have a few properties and
these "helper" functions or methods available? My update/delete/inserts are
very specific (I call SQL Server 2000 stored procedures to do the work - not
embedded or dynamic SQL) unless the functions you are referring to are so
generic and all you do is to pass table names, fieldnames etc..etc.. to the
methods which in turn would do the inserts/updates etc..etc...

Help?

Brad
 
R

RobinS

Are you still looking for some help or did you figure this out?

RobinS.
-----------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top