Need help on 3-Tier Architecture Concept RRS feed

  • Question

  • Sorry if this post should'nt belong here. I'm new to programming and I need advise as to whether my concept on a simple 3-tier architecture design make sense.

    I have a project (presentation layer) containing just the window forms. A project (business logic layer) that contains the objects classes. And a project (data access layer) that contains the DAOs.

    The presentation layer project has a reference to the business logic project. So in this way, I created a object based on values keyed into the presentation layer forms. In the business logic projects, in my object class, I have a void MyObj.AddObject() which calls the Data access project's MyObjDAO.InsertObject(MyObj obj) that performs the database insertion.

    I went ahead with this concept and realise my folly. 2 things happen here: firstly, there is a circular dependency which is not allowed (Business reference Data Access and Data Access reference Business). However if you have added a reference to the business logic dll file instead, you face the error whereby your presentation layer make more than 1 reference to the same assembly.

    What i want to achieve is to pass the object created from the presentation and insert into Database by passing the created object around so that a 3 -tier design and decoupling are followed. Can anyone be kind to share some light on a design approach that can accomplish the above and also to achieve a good 3 tier design. Sorry if this sounds newbie.

    I am having these impressions:

    1. Not have the DAO in a separate project. This avoids having to add a reference to the Business dll. But does that considered a 3-tier approach too?

    2. Design the signatures of DAO.InsertObject() to accept parameters (string, boolean, int) and perform the necessary insertion within the method.


    a keen learner
    Saturday, May 31, 2008 7:15 PM

All replies

  • Hello Keen,


    you need to separate your entities into a different dll, you are encapsulating your entities (object classes) inside the business layer and all of tiers are using them so you will encounter circular dependencies business and data layers as data needs the business dll to use the entities and business needs the data dll to perform DB operations, so move your entities into a separate dll and add that dll as a reference to each project (layer) you have.



    Saturday, May 31, 2008 8:12 PM