Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

n-Tier doubt!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
IsRaEl - 05 Sep 2007 04:56 GMT
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...
sloan - 05 Sep 2007 08:25 GMT
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.

> Hello everyone,
>
[quoted text clipped - 74 lines]
>
> thanks in advance...
nightwatch77 - 05 Sep 2007 09:03 GMT
Get an OR-mapper and see how it models the data. For example
nhibernate or sooda.

RG
> You can check my example at:http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!140.entry
>
[quoted text clipped - 87 lines]
>
> > thanks in advance...
Arne Vajhøj - 09 Sep 2007 02:01 GMT
> 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
[quoted text clipped - 68 lines]
> 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
Arne Vajhøj - 09 Sep 2007 02:03 GMT
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.