Business logic level

I am programming data driven applications using asp.net with telerik controls (v2009 q2). I have a class called BLL that contains (almost only) static classes that return different objects that take some id as a parameter. Usually returns a group of objects in the form of lists.

My question is that there are some architectural flaws, always static. I know that people make their Busines Layer and DataAccess level as different projects. What is the advantage of this project? So I can add more functionality or just more neatly.

Thank you in advance

+3
source share
6 answers

, . , , , . , , . , , , , .

/ . , , -, , .

:

  • , , .
  • , , .
  • , , , BLL DAL. , , BLL.

, . , .

  • , ( C/++!). , , .
  • ( ) , , . , , , .
  • Visual Studio.NET, , . , .
  • BLL DAL . , , , . , . , , , # 3.

, , , . , , intellisense , , , . , ( ) . , , , . .

+2

BLL DAL (.. ) , , , DLL ( , , , ). , .

-, , .

+1

, / . , , BLL , .

0

, , BLL, , DLL bin, IIS, -

0

, , static.

, . - Singleton, .

I know that people create their business layer and DataAccess as different projects. What is the advantage of being a project? Therefore, I can add more functionality or just more neat in this way.

Benefits:

  • Easier to work with multiple developers (depending on environment and source)
  • Force separation of logic / protection levels from the rest of your solution.
  • It is easier to group and manage if your BLL is getting big.
0
source
namespace BLL
{
    public class tblCity
    {
        public tblCity()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        private int iCityId;
        private string sCityName;

        public int CityId
        {
            get
            { return iCityId; }
            set
            { iCityId = value; }
        }
        public string CityName
        {
            get
            {
                return sCityName;
            }
            set
            { sCityName = value; }

        }
        public int InserttblCity()
        {
            DBAccess db = new DBAccess();
            //db.AddParameter("@iSid", iSid);
            db.AddParameter("@sCityName", sCityName);

            return db.ExecuteNonQuery("tblCity_Insert", true);
        }
        public DataSet SelectAlltblCity()
        {
            DBAccess db = new DBAccess();
            return db.ExecuteDataSet("tblCity_SelectAll");
        }
        public DataSet CheckCityName()
        {
            DBAccess db = new DBAccess();
            db.AddParameter("@sCityName", sCityName);
            return db.ExecuteDataSet("tblCity_CheckCity");
        }
        public DataSet SelectDistinctCityWithId()
        {
            DBAccess db = new DBAccess();
            //db.AddParameter("@iCityName", iCityName);
            return db.ExecuteDataSet("tblCity_getLastId");
        }
        public int UpdatetblCity()
        {
            DBAccess db = new DBAccess();
            db.AddParameter("@iCityId", iCityId);
            db.AddParameter("@sCityName", sCityName);
            return db.ExecuteNonQuery("[tblCity_Update]", true);
        }
        public int DeletetbltblCity()
        {
            DBAccess db = new DBAccess();
            db.AddParameter("@iCityId", iCityId);

            return db.ExecuteNonQuery("[tblCity_Delete]", true);
        }
        public DataSet FindPropertyLocationSubCategory()
        {
            DBAccess db = new DBAccess();
            db.AddParameter("@iCityId", iCityId);
            return db.ExecuteDataSet("tblPropertyDetails_FindPropertyLocationSubCategory");
        }
        public DataSet SelectDistinctPLCNAmeWithId()
        {
            DBAccess db = new DBAccess();

            return db.ExecuteDataSet("tblCity_getLastId");
        }

    }
}
-1
source

Source: https://habr.com/ru/post/1723280/


All Articles