业务逻辑层的使用 [英] Uses of Business Logic Layer

查看:77
本文介绍了业务逻辑层的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可能是一个重复的问题.但是我从未找到像我这样的初学者可以理解的正确解释.

I know this may be a duplicate question. But i never found a correct explanation that a beginner like me can understand.

我的问题是我们在业务逻辑层中可以做的所有事情".我已经完成了3层架构项目.但是我只使用BLL在UI和数据层之间传递值.

My question is "What all things we can do inside Business Logic Layer". I have done 3 tier architecture projects. But I used BLL only to pass values between UI and Data Layer.

但是,每当我参加面试时,他们都会问我,您在BLL内部所做的所有事情.
请帮助我了解BLL的正确用法.
如果可以的话,请提供一些示例代码.

But whenever i attend an interview they asks me what all things you do inside BLL.
Please help me to understand the correct use of BLL.
Please provide little bit of sample code if you can.

推荐答案

此问题可能会被删除,因为它不是stackoverflow喜欢的格式.

This question may get deleted because it is not in the format that stackoverflow likes.

BLL处理业务逻辑,例如如何执行特定公式或执行工作流程.通常将包含公司希望实施的规则.

BLL handles the business logic such as how to do a specific formula or execute a workflow. It will typically contain rules that a company wishes to implement.

数据层通常仅从数据库,文件或某些其他数据源获取数据,并且不对其进行任何进一步的修改.通常是业务层将数据加载到某种与业务相关的类/对象中.BLL还可以在将数据层的数据传递到UI层之前对其进行修改.UI层仅执行简单的验证,并呈现从BLL获得的数据

The data layer typically just gets data from the database, file or some other data source and doesnt do any further modification to it. It is usually the business layer that loads the data into some kind of business relevant class/object. The BLL may also modify the data from data layer before it passes it to the UI layer. The UI layer only does simple validations and renders the data it gets from the BLL

例如.

在数据层

您可能有一个功能

public DataSet GetAllAccounts()
{
 DataSet ds;
 //Some sql code to read out the sql data using datareader and dataadapter;
 return ds;
}

在业务层中您可以拥有

public List<Account> GetAllAccounts()
{
 DataSet ds = DataLayerClass.GetAllAccounts();
 return (from Tab1 in ds.Tables[0] select new Account(){AcctNum =Tab1.AcctNum, Name =Tab1.Name}).ToList();
}

如您所见,Account是特定于业务的对象,而DataSet是与db相关且不关心业务或任何业务规则的事物.

As you can see, Account is a business specific object whereas DataSet is something that is relating to the db and doesnt care about business or any business rules.

这篇关于业务逻辑层的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆