n-Tier doubt!!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • IsRaEl

    #1

    n-Tier doubt!!

    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..e tc..

    need help please...

    thanks in advance...

  • sloan

    #2
    Re: n-Tier doubt!!


    You can check my example at:
    http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!140.entry

    I have a strong inclination to seperate the Client class from the class
    (ClientManager or ClientControlle r) 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.




    "IsRaEl" <yzraeu@gmail.c omwrote in message
    news:1188964571 .186163.254430@ r29g2000hsg.goo glegroups.com.. .
    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..e tc..
    >
    need help please...
    >
    thanks in advance...
    >

    Comment

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

      #3
      Re: n-Tier doubt!!

      IsRaEl wrote:
      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..e tc..
      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

      Comment

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

        #4
        Re: n-Tier doubt!!

        Arne Vajhøj wrote:
        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


        Comment

        Working...