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项目中的设计体验如何?
欢迎交流!
要满足英语,德语,法语等不同语种和文化客户的需要。
数据库要同时满足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项目中的设计体验如何?
欢迎交流!
相关文章推荐
- [导入]Thow to use the AspnetUpload control 2.1(2)
- How To: Use Forms Authentication with SQL Server in ASP.NET 2.0
- I learned several ASP.NET's AJAX ability today! It is so interesting and so easy to use AJAX in ASP.NET.
- How to use Console.WriteLine in ASP.Net (C#) during debug?
- How to use Console.WriteLine in ASP.Net (C#) during debug?
- Some of the new features from ASP.NET 2.0
- does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET File
- How To: Use Role Manager in ASP.NET 2.0
- Three steps to use jQuery UI in ASP.NET MVC 5
- How to use AspnetUpload™ in your web application
- New ASP.NET Features and Fixes in Visual Studio 2015 RC
- Use the MachineKey API to protect values in ASP.NET
- 【Pro ASP.NET MVC 3 Framework】.学习笔记.9.SportsStore:Securing the Administration Features
- Use Office Web Components to Load Excel and perform calculations in ASP.NET
- (转)How to use the ASP.NET MVC ModelBinder
- New Features in ASP.NET MVC 3/4
- Use Response.Filter来简体繁体转换 静态页生成. 利用UrlRewrite,asp.net动态生成htm页面
- EF Core使用SQL调用返回其他类型的查询 ASP.NET Core 2.0 使用NLog实现日志记录 CSS 3D transforms cSharp:use Activator.CreateInstance with an Interface? SqlHelper DBHelper C# Thread.Abort方法真的让线程停止了吗? 注意!你的Thread.Abort方法真
- Use Windows Authentication in ASP.NET 2.0/ASP.NET 2.0 中的 Windows 身份验证
- Simple ASP.NET 2.0 Tips and Tricks that You May (or may not) have Heard About [from dwahlin]