您的位置:首页 > 编程语言 > ASP

ASP.NET features we use, ASP.NET experience I have

2004-06-21 17:31 561 查看
我现在参与的是一个multilingual ,multi-culture 基于web的项目。
要满足英语,德语,法语等不同语种和文化客户的需要。
数据库要同时满足Oracle和 MSSQL.
虽然说我们用了ASP.NET,但是我觉得并不是正宗的ASP.NET
我们只用到了其中的几个feature,很多的可以说是ASP.NET精髓的东西都没有用。
我们的Leader以前做ASP,PHP的经验比较丰富,所以对ASP.NET的一些新功能不是很感兴趣.
所以一些coding的要求也很有意思.

1. 我们用VS.NET 开发项目,code-behind,这点还不错,没让用EditPlus.
2. 我们不用ASP.NET的Event,delegate机制.
Leader认为Http协议本身就Requst,Response,引入event是把简单的事情复杂化了.
所以我们只在Page_Load()里面写代码.
3. 我们不用ViewState. EnableViewState=“false“
4. 我们尽量不用ASP.NET Server Control,当然不用DataGrid,尽量用html 元素和Html Controls.
如果是GUI相关元素,或者这个元素需要在Post以后恢复或者赋值,就把这个元素的属性设为 runat=server
5. 所有Form元素的值用Requst.Form[]取得.

我以前php,asp,jsp都有一定的经验,所以下面的代码结构我还是很快熟悉并习惯了.
我们用的最多的runat=server.和html control的动态输出.
我们的代码结构如下:
Page_Load()
{
//fetch configuration
//fetch the GUI element for the current culture
doInit();
//check and get the URL parameter values;
checkParameterElements();
if the page is post back then
//check and get the posted Form values;
checkFormElements();
if need to write to database then
writeToDatabase();
if no error happen then
//The non-GUI related data are retrieved from the database and render here.
renderDataUI();
if no error happen then
//GUI element render here
renderGUI();
}

常用的表格输出代码:
System.Web.UI.HtmlControls.HtmlTableRow tr;
System.Web.UI.HtmlControls.HtmlTableCell td;
foreach(DataRow dataRow in sortedTable.Rows)
{
tr = new HtmlTableRow();
td = new HtmlTableCell();
td.innerHtml="some stuff";
tr.cells.add(td);
table.rows.add(tr);
}
对于多语言界面和多数据库支持.我们用了同样的方法.
不同语言的text和不同数据库的sqlstring都放在数据库里面.
只是text表里面多了一个语言id字段,区分不同语言的text
sqlstring表里多了一个数据库id字段,区分不同的数据库 sqlstring
没有用到存储过程什么的.
我也看了PetShop 3里面的Present Layer ,Business Logic Layer, Data Access Layer划分.

经过一段的程序设计的体验,我慢慢习惯了我们目前的这种设计
也算是一种Framwork or Architecture 吧.


不知道各位朋友在类似项目或者ASP.NET项目中的设计体验如何?
欢迎交流!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐