三层架构中的业务层
我去参加面试,并被要求展示我的业务层架构。我对三层架构有一些想法,但真的不知道在面试官面前要写什么。 因此,假设我的项目涉及一个组织的员工,那么我会在那里写什么。它是我应该制作的任何类型的图表还是一些编码部分。我在 C# 框架 3.5 中工作。我真的不明白这个问题还需要提到什么,所以如果需要什么,请告诉我。谢谢。
编辑 我在 winform 中工作。 我知道什么是业务层,但是不知道该告诉面试官什么,因为业务层有代码,而且显然我的项目有点大,所以代码量很大。那么我应该在那里写什么?
I went for an interview, and was asked to show up my Business layer architecture. I have some idea about 3 tier architecture but really no idea, to what to write in front of interviewer.
So suppose my project deals with Employees of an organization, then what would i have written there. Will it be any kind of diagrams i should have made or some coding part. I worked in C# framework 3.5. I really don't understand what else to mention in this question, so please let me know if something is required.Thanks.
Edit
I worked in winforms.
I know what Business layer is, but was not sure what to tell the interviewer as business layer has codes and obviously my project was a bit big, so there were huge numbers of codes. So what i should have written there??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
3 层架构由 3 个主要层组成
每个顶层仅询问下层并且从来没有看到上面有任何东西。
当他们询问您您将如何构建 BLL 时,您可以这样写:
作为我正在创建的项目的实例:
PL 都是公开的服务,我的 DAL 处理对数据库的所有访问,我有一个服务层处理 2服务的版本,旧的 ASMX 和新的 WCF 服务,它们通过接口公开,因此我可以轻松地即时选择用户将使用的服务
在上面的代码中,我只是使用依赖注入来分离另一层的知识,因为在这一层(表示层,因为这是 MVC 项目中的控制器)它不应该关心如何调用服务以及用户使用的服务
ServiceA
而不是ServiceB
...它需要知道的是,调用IService.ListAllProjects()
将给出正确的结果。您开始划分建议,如果服务连接中出现问题,您知道这与表示层无关,它是服务层(在我的例子中),并且很容易修复,并且可以轻松部署新的服务。 dll 而不是再次发布整个网站...
我还有一个助手,它保存我在所有项目中使用的所有业务对象。
我希望它有帮助。
a 3 tier Architecture is composed by 3 Main Layers
each top layer only asks the below layer and never sees anything on top of it.
When They ask you about How will you build your BLL, you can write something like:
As a live example of a project I'm creating:
PL's are all public exposed services, my DAL handles all access to the Database, I have a Service Layer that handles 2 versions of the service, an old ASMX and the new WCF service, they are exposes through an
Interface
so it's easy for me to choose on-the-fly what service the user will be usingIn the code above, I simply use Dependency Injection to separate the knowladge of the other layer, as at this layer (the Presentation Layer as this is a Controller in a MVC project) it should never care about how to call the Service and that the user uses
ServiceA
instead ofServiceB
... What it needs to know is that calling aIService.ListAllProjects()
will give the correct results.You start dividing proposes and if a problem appears in the service connection, you know that's nothing to do with the Presentation Layer, it's the service Layer (in my case) and it's easy fixed and can be easily deployed a new
service.dll
instead publishing the entire website again...I also have a helper that holds all Business Objects that I use across all projects.
I hope it helps.
业务逻辑定义为与应用程序数据的检索、处理、转换和管理有关的任何应用程序逻辑;业务规则和政策的应用;并确保数据的一致性和有效性。为了最大限度地提高重用机会,业务逻辑组件不应包含特定于用例或用户故事的任何行为或应用程序逻辑。业务逻辑可以进一步细分为以下两类:
Business logic is defined as any application logic that is concerned with the retrieval, processing, transformation, and management of application data; application of business rules and policies; and ensuring data consistency and validity. To maximize reuse opportunities, business logic components should not contain any behavior or application logic that is specific to a use case or user story. Business logic can be further subdivided into the following two categories:
业务层负责所有业务逻辑层。例如
你有组织,所以员工的组织和集合。
在员工对象中需要实施一些限制或一些规则。
该规则将在这一层实现。
Business layer layer that responsible for all business logic. For example
you have Organizarion so organization and collection of employee.
In employee object need to implement some restriction or some rules.
This rules will be implemented in this layer.
3 层如下,
网络表单将成为表示层
因此,根据我的理解,对于员工类,在 ASP.Net 代码隐藏文件中执行的任何操作都可以被视为业务层,因为您使用 if/else 等应用业务规则。
App_Code 文件夹中的数据访问类将是数据层。
对于桌面应用程序,表单设计将是表示层,表单代码将是业务层,与访问数据库相关的任何内容将是数据层。
3 Tier is as follows,
Webforms will be presentation layer
So for employee class doing anything in ASP.Net code behind file can be considered business layer per my understanding as you are applying business rules using if/else and so forth.
Data Access classes in App_Code folder would be Data Layer.
In case of desktop apps form designs would be presentation layer, form code will be business layer and anything related to accessing database would be data layer.
三层架构是一种由逻辑计算的三个“层”或“层”组成的软件架构。它们通常在应用程序中用作特定类型的客户端-服务器系统。三层架构通过模块化用户界面、业务逻辑和数据存储层,为生产和开发环境提供了许多好处。
业务逻辑层:业务逻辑是管理最终用户界面和数据库之间通信的编程。业务逻辑的主要组成部分是业务规则和工作流。
业务逻辑层 (BLL),充当表示层和 DAL 之间数据交换的中介。在实际应用程序中,BLL 应作为 App_Code 文件夹中的单独类库项目实现,以简化项目结构。下面说明了表示层、BLL 和 DAL 之间的架构关系。
BLL 将表示层与数据访问层分开并强加业务规则

A 3-tier architecture is a type of software architecture which is composed of three “tiers” or “layers” of logical computing. They are often used in applications as a specific type of client-server system. 3-tier architectures provide many benefits for production and development environments by modularizing the user interface, business logic, and data storage layers.
Business Logic Layer: Business logic is the programming that manages communication between an end user interface and a database. The main components of business logic are business rules and workflows.
A Business Logic Layer (BLL) that serves as an intermediary for data exchange between the presentation layer and the DAL. In a real-world application, the BLL should be implemented as a separate Class Library project in App_Code folder in order to simplify the project structure. below illustrates the architectural relationships among the presentation layer, BLL, and DAL.
The BLL Separates the Presentation Layer from the Data Access Layer and Imposes Business Rules
