为什么在.Net上使用3层 [英] Why Use 3-tier On .Net

查看:63
本文介绍了为什么在.Net上使用3层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是开发人员,从2年开始。我从未在.net中使用3层架构。它需要学习3层架构以供将来使用。或者它是旧技术。基本上我是使用EntityFramework和dataset.One更多的事情为什么我们使用存储过程。我正在使用两个主要的MNC项目在过去。但我从来没有要求使用存储过程。

I'm Developer from 2 years .I never Use 3 tier architecture In .net.Is it Required to learn 3 tier architecture for future use.Or It's Old Technology. Basically I'm Used EntityFramework and dataset.One More Thing Why We Use Stored Procedure.I'm Work with two major MNC Project's In Past .But I never required to Use Stored Procedure.

推荐答案

三层不是旧技术或新技术:它是一种开发方法,它鼓励我们将关注点分成逻辑组:用户界面,业务逻辑和后端存储。分离意味着分离意味着我们可以在需要改进时重用或替换部分。



例如,您可以从单个用户Access数据库开始,然后升级多用户SQL DB而不更改UI或BL。

或者您可以在不影响BL或DB的情况下为Web应用程序而不是Winforms重写UI。



这不是必需的,但对于许多任务来说这是一种明智的方法,并且可以提高可靠性,因为它更严格地规范了模块之间的接口。



存储过程不是每个人都喝茶:有些人根本不使用它们,有些人将它们用于所有事情:我更愿意认为我有一个明智的中间地带,在那里完成在DB中更好地处理的任务所以实际的数据库组织不必暴露 - 甚至是数据访问层。这并不意味着SP可以取代DAL - 但如果正确使用,它们可以补充它,减少带宽使用并提高可靠性和性能。

但就像其他任何东西一样,如果用得不好,他们可以将一个漂亮的简单系统变成一个可怕的混乱。
Three tier isn't old technology, or new technology: it's a development methodology which encourages us to separate concerns into logical groups: User interface, business logic and back end storage. And the idea is that the separation means we can reuse or replace sections when improvements are needed.

For example, you could start with a single user Access database, and upgrade to a multiuser SQL DB without changing the UI or BL.
Or you could rewrite the UI for a web application instead of Winforms without affecting the BL or DB.

It's not required, but it is a sensible approach for many tasks, and can improve reliability as it more strictly formalises the interface between modules.

Stored Procedures are not everyone's cup of tea: some don't use them at all, some use them for everything: I prefer to think I have a "sensible middle ground" where tasks which are better handled completely within the DB are done there so that the actual DB organisation doesn't have to be exposed - even to the Data Access Layer. That doesn't mean that SP's can replace a DAL - but they can complement it, reducing bandwidth usage and improving reliability and performance if used correctly.
But just like pretty much anything else, they can turn a nice simple system into a gawd-awful mess if used badly.


Old或new 完全无关紧要。技术是否合适,过时与否;一些新技术可能已经过时(有些技术即使在推出市场时已经过时),而且一些旧技术在这个时刻绝对是实际的,并且会长期存在。



现在,3级中的数字3不是世界常数,不是自然法则。它根本不是技术。只是在很多设置中,3层呈现出合适的架构。你甚至不能学习3层架构。您可以学习相关的架构解决方案,但更重要的是,您需要学习用于制作和链接层的技术组件。您应该总是来自应用程序系统的目标。如果3层不够,则创建4.如果2足够,则创建2.



-SA
"Old" or "new" is totally irrelevant. Technology can be suitable or not, outdated or not; some new technology can be outdated (there are cases when technology is outdated even at the moment when it it presented to the market), and some old technologies are absolutely actual at this moment and will be actual for a long time.

Now, the number "3" in the term 3-tier is not a world constant, is not a law of nature. It is not a technology at all. It's just that in very many setting 3 tiers present suitable architecture. You cannot even "learn 3-tier architecture". You can learn related architectural solution, but more importantly, you need to learn technological components used to make and link the tiers in general. You should always come from the goals of the application system. If 3 tiers are not enough, create 4. If 2 is enough, create 2.

—SA

这篇关于为什么在.Net上使用3层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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