Buiness Logic Layer有什么用?为什么我们不直接从表示层调用DAL? [英] what is the use of Buiness Logic Layer. why do not we call directly DAL from Presentation Layer?
问题描述
商业实体层。
***************
公共类BEL
{
#region变量
私人字符串名字;
#endregion < br $>
公共字符串名字
{
get {return firstname; }
set {firstname = value; }
}
}
演示层:
**** **********
protected void save_click(object sender,EventArgs e)
{
string output = string.Empty;
BEL ObjUserBEL = new BEL();
ObjUserBEL.Firstname = txtfirstname.Text.ToString()。Trim();
BLL ObjUserBLL = new BLL();
output = ObjUserBLL.insertuserdetails(ObjUserBEL);
}
我还有一层DAL.cs(数据访问层)。
在这里我怀疑。
而不是像下面那样给予。
BLL ObjUserBLL = new BLL();
输出= ObjUserBLL.insertuserdetails(ObjUserBEL);
i可以直接给DAL.cs图层吗?如下所示
DAL objUserDAL =新DAL();
输出= objUserDAL.insertuserdetails(ObjUserBEL);
当我浏览时,我得到了类似于验证的信息。我不明白,也没有找到任何验证。
那么,BAL(业务访问层)的需求是什么?如果没有BAL,它会调用DAL层并完成所有功能。
请澄清我..
Business entity layer.
***************
public class BEL
{
#region variable
private string firstname;
#endregion
public string Firstname
{
get { return firstname; }
set { firstname = value; }
}
}
presentation layer:
**************
protected void save_click(object sender, EventArgs e)
{
string output = string.Empty;
BEL ObjUserBEL = new BEL();
ObjUserBEL.Firstname = txtfirstname.Text.ToString().Trim();
BLL ObjUserBLL = new BLL();
output = ObjUserBLL.insertuserdetails(ObjUserBEL);
}
and i have one more layer DAL.cs (Data Access Layer).
here i got doubt that.
Instead of giving like below.
BLL ObjUserBLL = new BLL();
output = ObjUserBLL.insertuserdetails(ObjUserBEL);
i can give directly to DAL.cs layer right? like below
DAL objUserDAL = new DAL();
output=objUserDAL.insertuserdetails(ObjUserBEL);
when i browse, i got information like it is for validation. i do not understand and not find any validation.
so, what is the need of BAL (Business access Layer) ? without BAL also, it calls DAL layer and do all function.
kindly clarify me..
推荐答案
什么是商业逻辑层的好处? [ ^ ]
这篇关于Buiness Logic Layer有什么用?为什么我们不直接从表示层调用DAL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!