需要澄清三层和背后的代码 [英] Need Clarification on Three Tier and Code Behind

查看:47
本文介绍了需要澄清三层和背后的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,





我需要澄清编写代码隐藏文件中的所有代码与
$之间的区别b $ b使类分离DAL和BAL。我用谷歌搜索但无法明确的想法。

哪个最好,为什么?





问候,

Pal。

Hi All,


I need a clarification on Difference between writing all Codes in Code Behind File and
making Class separating DAL and BAL. I googled But Couldn't get Clear Idea.
Which is best and Why?


Regards,
Pal.

推荐答案

按照此处提供的所有链接:ASP.Net 3层体系结构 [ ^ ]和了解C#中的3层架构 [ ^ ]你一定会清楚的。



问候..
Follow all the links provided here : ASP.Net 3-Tier architecture[^] and Understand 3- Tier Architecture in C#[^] and you will definitely be clear.

Regards..


在代码隐藏中编写所有代码是件很难看的事情。单个文件(在页面中)中的大量代码会使事情变得更难。很难调试。



某些代码的单独类(如DB相关,通用)是代码可重用性,可维护性。并且易于调试。虽然迁移这种方式很简单,因为你在单独的类/层中分离了东西,所以你只需要开发与UI相关的东西。



这里有一篇示例文章

使用N创建ASP.NET应用程序-Tier Architecture [ ^ ]

还要看看 MVC [< a href =http://www.asp.net/mvctarget =_ blanktitle =新窗口> ^ ]
Writing all code in code-behind is ugly thing. Massive code in single file(in a page) will make things harder. Tough to debug.

Seperate classes for some code(like DB related, generic) is for code reusability, maintainability. And easy for debugging. While migration this way is easy, because you have seperated things in seperate classes/layers so you'll have to develop only UI related things.

Here a sample article
Creating ASP.NET Applications with N-Tier Architecture[^]
And also take a look at MVC[^]


这篇关于需要澄清三层和背后的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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