n-Tier doubt!!

I

IsRaEl

Hello everyone,

I'm with a lot of questions about how to design a n-Tier, how to do
the code how to organize, and all the samples that i find, are with
only one table, one class with DataAcess, i need something more
"Complex"..

maybe you guys have a little sample with maybe a User class, and a
UserGroup class that is related with the User class...and a Project
class that is connected with a Client class that is connected with a
ClientContacts class...and the Project class have a ProjectStatus...

my biggest doubt is what should i do when designing them???

is this right?

public class Client
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}


public void Insert() {
//Access to DAL
}
public void Delete() {
//Access to DAL
}
public void Update() {
//Access to DAL
}

public class Contact
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}

public void Insert()
{
//Access to DAL
}
public void Delete()
{
//Access to DAL
}
public void Update()
{
//Access to DAL
}

}

}


because that sucks...

i have to declare the Client class...if i want to access the Contacts
form a Client i have to:

Client.Contact Contact = new Client.Contact();
Contact.Name..etc..

need help please...

thanks in advance...
 
S

sloan

You can check my example at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry

I have a strong inclination to seperate the Client class from the class
(ClientManager or ClientController) that creates the Client class.

Please note a difference between N-Layered and N-Tiered designs. My example
is N-Layered, because all code is deployed on a single machine.

Go a google search for N-Tier and N-Layer and you'll find defintions for
them.


Good luck.
 
N

nightwatch77

Get an OR-mapper and see how it models the data. For example
nhibernate or sooda.

RG
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

IsRaEl said:
I'm with a lot of questions about how to design a n-Tier,

I think you question is about an object model and rather unrelated
to n-tier (and n-layer).
how to do
the code how to organize, and all the samples that i find, are with
only one table, one class with DataAcess, i need something more
"Complex"..

maybe you guys have a little sample with maybe a User class, and a
UserGroup class that is related with the User class...and a Project
class that is connected with a Client class that is connected with a
ClientContacts class...and the Project class have a ProjectStatus...

my biggest doubt is what should i do when designing them???

is this right?

public class Client
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}


public void Insert() {
//Access to DAL
}
public void Delete() {
//Access to DAL
}
public void Update() {
//Access to DAL
}

public class Contact
{
private string _Name = string.Empty;

public string Name
{
get
{ return _Name; }
set
{ _Name = value; }
}

public void Insert()
{
//Access to DAL
}
public void Delete()
{
//Access to DAL
}
public void Update()
{
//Access to DAL
}

}

}


because that sucks...

i have to declare the Client class...if i want to access the Contacts
form a Client i have to:

Client.Contact Contact = new Client.Contact();
Contact.Name..etc..

I would move Contacts class out of Client class.

I would prefer to have the DAL access storing/retrieving/modifying
class X outside of class X.

I would have a constructor with argument (and one without).

Arne
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Arne said:
I would move Contacts class out of Client class.

I would prefer to have the DAL access storing/retrieving/modifying
class X outside of class X.

I would have a constructor with argument (and one without).

Note that the above is just some comments to the posted code not what
is necessary for a good object model.

Arne
 

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