locked
3 tier architecture circular dependency. RRS feed

  • Question

  • I started to create a project for practice purpose and I thought I should have 3 tier programming structure.

    I wanted to create a memberinfo system in which I have a presentationClass , MemberBusinessLayer class and 3rd dataLayer.

    I said to myself My PresentationLayer should only contact with MemberBusinessLayer class to get the data and MemberBusinessLayer class should get the data from me from dayalayer class. However i saw problem..

    In BusinessLayer class I have public member properties for example FirstName, LastName, Address.

    In DataLayer class I created a method Public List GetMember(string) . and in my design there is a method SendDataToPresntationLayer() in BusinessLayer class that is calling a GetMembe() method of dataLayer class. I see that is wrong. I am trying to get GetMember returns BusinessLayer object and I am calling getmember in BusinessLayer class.

    Well I don't think I can't work with only 3 classes. My design is wrong. There is something more that I need to do. Can somoene help me. Please I am trying to learn I might be very much wrong but I am trying.

    thanks

    Monday, September 23, 2013 2:38 PM

All replies

  • You have differnt options.

    I would go to have a separate class MemberModel to store data. A POCO object or even a complex one.

    Other option could be to have a IMember interface and just reference the interface from your DAL. Your BLL class will implement this interface and you can pass a instance to the DAL for populate or use Dependency Injection to get an implementation of it on the DAL.

    You have a world of options there :)


    Juan Casanova http://jawsofdotnet.blogspot.com - My .Net babling blog

    Monday, September 23, 2013 7:47 PM
  • First off, you seem to be mixing the terms layers and tiers a lot, can you specify which it is you want, or rather provide an example of your expected deployment design? Secondly what is business layer doing over and above your data layer?

    http://pauliom.wordpress.com

    Sunday, November 3, 2013 5:40 PM