你有多少人做3层设计? [英] How many of you do 3-tier design?
问题描述
我发现很多人混淆了业务层和数据访问层,层次设计。
我更喜欢使用存储过程将数据层几乎全部移动到数据库中,并且在将sproc调用转换为业务的代码中拥有非常轻量级的数据层
如何处理?
编辑:如果你要做的是定义什么3层是,不要浪费你的时间回复。我正在寻找具体的人是如何实现的,您是否使用存储过程或ORM,您如何处理DAL和BLL之间的循环依赖?除了说
- UI
- 业务
- 数据
我一直在做一些主要的Web应用程序而现在又一直在追踪3层:
UI:纯ASPX页面。实际上,很难将您的业务层从这里下来,因为进行快速计算或者似乎在这里很容易做到。但是,我已经有足够的纪律,以确保页面上的代码什么都不做,只是显示/隐藏面板,更新用户输入等。
DAL:所有数据访问层的东西我非常喜欢使用可用的XSD / DataTable / TableAdapter类。我也使用基于存储过程的CRUD方法,所以将适配器挂接到存储过程很容易。
BLL:业务层往往是三层中最轻的在我的大部分应用程序中,因为它们主要是CRUD类型的应用程序,内置一些报告。
3-Tier design has been my standard design philosophy for years for database driven applications, and it has never failed me. For those who practice it, describe your layers.
I've found that many people muddle up the business tier and the data access tier, making it more like a 2.5-Tier design.
I prefer to move the data tier almost entirely into the database using stored procedures, and just have a very lightweight data tier in code that wraps sproc calls into business objects.
How do you approach it?
EDIT: If all you are going to do is define what 3-tier is, don't waste your time replying. I am looking for how specific people implemented it, did you use stored procedures or an ORM, how did you handle circular dependancies between the DAL and the BLL? Theres a lot of depth to this topic besides saying
- UI
- Business
- Data
I've been doing primarly web apps for a while now and have been following 3-Tier as well:
UI: Pure ASPX pages. It is actually kind of hard to push your business layer down from here at times because doing a quick calculation or something seems so easy to do here. However, I've gotten disciplined enough to make sure the code behind pages are doing nothing but showing/hiding panels, updating user input, etc.
DAL: All data access layer stuff. I have really enjoyed using the XSD/DataTable/TableAdapter classes that are available. I also use stored procedure based CRUD methods, so hooking up the adapters to the stored procs is easy.
BLL: The business layer tends to be the lightest of the three layers in most of my apps here, since they are primarily CRUD type apps with some reporting built in.
这篇关于你有多少人做3层设计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!