n-tier application reference issue

Thread is closed for posting
2 posts, 0 answers
  1. Tony
    Tony avatar
    7 posts
    Member since:
    Nov 2012

    Posted 03 Dec 2012 Link to this post

    • I have 3 layers

      * ASP.NET Web App (web forms) - presentation layer

      * Class Library with all business logics - BLL

      * Class Library with ORM (Model1)- DAL

      I have a method in BLL that returns an instance of an data context entity:

      Public Model1.Booking GetById(int bookingId)
            return context1.Bookings(b=>b.BookingId = bookingId);

      When I call this method in presentation layer I have to include the DAL connection string in web.config, and reference both the DAL and BLL:

      DAL.Model1.Booking booking = BLL.BookingManager.GetById(int bookingId);

      Is there a way to modify the BLL so that the presentation doesn't need to reference DAL? so that I'll be able to do something like this:

      BLL.Booking booking = BLL.BookingManager.GetById(int bookingId);

      Basically I'e like to make sure the web application has no knowledge about the DAL.

      thanks in advance

  2. Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 05 Dec 2012 Link to this post

    Hi Tony,

    There are different ways to avoid using Data Access Layer in Presentation Layer:
    1. You can use DTO layers with the Add OpenAccess Service Wizard. For more information and to see how its implemented, we provide a video and two samples in our SDK:
    - WinForms: Sofia Car Rental - WCF Plain Service with Windows Forms
    - WPF: Sofia Car Rental - WCF Plain Services

    2. You can create class wrappers in BLL for all your classes in DAL, and use them in your PL.

    If you need any further assistance, do not hesitate to post your questions.

    All the best,
    Boris Georgiev
    the Telerik team
    Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Back to Top