This is a migrated thread and some comments may be shown as answers.

n-tier application reference issue

1 Answer 80 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tony
Top achievements
Rank 1
Tony asked on 03 Dec 2012, 11:08 AM
  • 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

1 Answer, 1 is accepted

Sort by
0
Boris Georgiev
Telerik team
answered on 05 Dec 2012, 12:19 PM
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.
Tags
Data Access Free Edition
Asked by
Tony
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Share this question
or