none
Single Interface for both DAL & BLL? RRS feed

  • Question

  • Hi All,

    In our Asp.Net Application we are following below architecture,

    UI->BLL->DAL (Also we have one more layer for Interfaces and accessible by both BLL & DAL layers.)

    Is below architecture is correct?

    Repository Library:

    1. Entity Abstract Class

    public abstract class Entiry

    {

    public abstract bool Create();

    public abstract bool Update();

    }

    2. Academic Year Data Provider Interface for DAL

    public interface IAcademicYear

    {

    DataSet getAcademicYear();

    bool CheckDuplicateAcademicYear(int AcademicYear);

    }

    3. DAL Layer Academic Year Data Provider Class which implements IAcademicYear from Repository Layer

    public class AcademicYearProvider : IAcademicYear

    {

    public AcademicYearProvider(){ // constructor}

    public DataSet getAcademicYear() { // returns dataset result }

    public bool CheckDuplicateAcademicYear(int AcademicYear) { // returns bool value  }

    public bool InsertAcademicYear(params.....) { // insert logic for Create() method in Entity abstract class }

    }

    4. BLL Layer Academic year business logic class which implements Entity class

    public class AcademicYearLogic : Entity

    {

       //properties

       public string AcademicYear {get;set;}

       public string IsActive {get;set;} etc....

       public override bool Create() { return DAL.InsertAcademicYear(params...); //calls insert method in dal class  }

       public override bool Update() { return DAL.UpdateAcademicYear(params...); //calls update method in dal class  }

       public DataSet getAcademicYear() { return DAL.getAcademicYear(); }

       public bool CheckDuplicateAcademicYear(int AcademicYear) {return DAL.CheckDuplicateAcademicYear();}}

      In this approach can we use same interface for both BLL & DAL or can create separate interfaces for both BLL & DAL layer classes.

      Finally this total approach is correct or not? if not please suggest better approach for layer architecture.

    Thanks,

    Kiran


    Wednesday, January 13, 2016 3:56 AM

All replies

  • On first view doesn't look correct to me. What benefit do you see in the layers passing Dataset through them?

    http://pauliom.wordpress.com

    Thursday, January 14, 2016 8:04 PM
  • Hi,

    can you suggest the correct way to use?

    Friday, January 15, 2016 1:52 AM
  • IMO you are using layers to abstract away knowledge/responsibility of one layer to another. I.e. does the client want to know about how the data persistence schema? For example if your layers are; javascript/html, c#, SQL and tiers are browser, web server, SQL Server. The you would get the data from SQL into c# domain objects, then convert those to javascript models/view models. However, I must say that I wouldn't necessarily do that, it's just an example.

    http://pauliom.wordpress.com

    Saturday, January 16, 2016 9:58 AM