我感谢我正在使用的Drupal

mvc

10天任务按计划完成了,又进步了

感谢flea,感谢俺们总监,本来php没啥经验的我,一下子发现这php做东西太好了.有速度,有效率.以前学的.net吧,太依赖IDE了,用java嘛,不用SSH框架还感觉不习惯,用了又先得小题大做.于是乎这考虑了php,再加上flea这么便捷的mvc框架,才发现原来做web开发,是这么易Z.平时开个Dw搞网页设计,半个小时后这本子底下就开始烫手了.现在开一个sqlyog,一个UltraEdit就够做数据库驱动的网站了.五一也去过上海了,一行代码没敲,任务还是如期完成.这不还发现微软发布不就的asp.net的mvc跟我这几天刚学的flea框架的也就一个模式.下一个阶段开始学习下jQuery.毕竟咱还是做前端的.

Asp.net三层架构自动生成代码CodeSmith模版

asp.net模型层,CodeSmith代码自动生成模版

<%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Generates a very simple business object." %> <%@ Property Name="TargetTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="ModelsNamespace" Default="MyBookShop.Model" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Assembly Name="SchemaExplorer" %> <%@ Assembly Name="System.Data" %> <%@ Import Namespace="SchemaExplorer" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Text.RegularExpressions" %> <% PrintHeader(); %> using System; using System.Collections.Generic; using System.Text;

namespace <%= ModelsNamespace %> { ? ?[Serializable()] ?public class <%= GetModelClassName() %> ?{ ? ??private <%= GetPKPropertyType() %> <%= GetPKMemberVarName() %>; ??<% ?? ??if(TargetTable.ForeignKeys.Count > 0) ??{ ???foreach (TableKeySchema key in TargetTable.ForeignKeys) ???{ ??%> ??private <%= GetFKPropertyType(key) %> <%= GetFKMemberVarName(key) %>; ??<% ???}??? ??} ?? ??foreach (ColumnSchema column in TargetTable.NonKeyColumns) ???{ ???if(GetMemberVariableDefaultValue(column) != "") ???{ ??%> ??private <%= GetPropertyType(column) %> <%= GetMemberVarName(column) %> = <%= GetMemberVariableDefaultValue(column) %>; ??<% ???} ???else ???{ ??%> 节省页面省去后续大量代码......下载CodeSmith代码模板文件dbmadmodels

asp.net三层架构数据访问层,CodeSmith代码自动生成模版

<%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Generates a very simple business object." %> <%@ Property Name="TargetTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="ModelsNamespace" Default="MyBookShop.Model" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="DALNamespace" Default="MyBookShop.DAL" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="DALClassNameSurfix" Default="DAL" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Assembly Name="SchemaExplorer" %> <%@ Assembly Name="System.Data" %> <%@ Import Namespace="SchemaExplorer" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Text.RegularExpressions" %> <% PrintHeader(); %> using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using <%= ModelsNamespace %>; namespace <%= DALNamespace %> { ?public class <%= GetDALClassName() %> ?{ ??<%-- public? Book AddBook(Book book) --%> ??????? public? int Add<%= GetModelClassName() %>(<%= GetModelClassName() %> <%= GetModelParamName() %>) ??{ ??????????? string sql = ????<%= GetInsertSQLLine1()%> ????<%= GetInsertSQLLine2()%> ???? ???sql += " ; SELECT @@IDENTITY"; ??????????? try ??????????? { ????SqlParameter[] para = new SqlParameter[] ????{ ?????<% ?????foreach(TableKeySchema key in TargetTable.ForeignKeys) ?????{ ?????%> ?????new SqlParameter("@<%= GetFKForeignIdName(key) %>", <%= GetModelParamName() %>.<%= GetFKPropertyName(key) %>.<%= GetFKPrimaryIdName(key) %>), //FK ?????<% ?????} ?????for(int i=0; i<TargetTable.NonKeyColumns.Count-1; i++) ?????{ ??????ColumnSchema column = TargetTable.NonKeyColumns[i]; ?????%> ?????new SqlParameter("@<%= column.Name %>", <%= GetModelParamName() %>.<%= column.Name %>), ?????<% ?????} ?????for(int i=TargetTable.NonKeyColumns.Count-1; i<TargetTable.NonKeyColumns.Count; i++) ?????{ ??????ColumnSchema lastColumn = TargetTable.NonKeyColumns[i]; ?????%> ?????new SqlParameter("@<%= lastColumn.Name %>", <%= GetModelParamName() %>.<%= lastColumn.Name %>) ?????<% ?????} ?????%> ????}; ???? ??????????????? int row = SqlHelper.ExecuteSql(sql, para); ????return row; ??????????? } ??????????? catch (Exception e) ??????????? { ??????????????? throw e; ??????????? } ??} ?? ??节省页面省去后续大量代码......下载CodeSmith代码模板文件dbmaddal

asp.net三层架构业务层,CodeSmith代码自动生成模版

<%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Generates a very simple business object." %> <%@ Property Name="TargetTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="ModelsNamespace" Default="MyBookShop.Model" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="DALNamespace" Default="MyBookShop.DAL" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="BLLNamespace" Default="MyOffice.BLL" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="BLLClassNameSurfix" Default="Manager" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Property Name="DALClassNameSurfix" Default="DAL" Type="System.String" Category="Context" Description="TargetTable that the object is based on." %> <%@ Assembly Name="SchemaExplorer" %> <%@ Assembly Name="System.Data" %> <%@ Import Namespace="SchemaExplorer" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Text.RegularExpressions" %> <% PrintHeader(); %> using System; using System.Collections.Generic; using System.Text; using <%= DALNamespace %>; using <%= ModelsNamespace %>; namespace <%= BLLNamespace %> { ??? public class <%= GetBLLClassName() %> ??? { ??private static readonly <%= GetDALClassName() %> dal = new <%= GetDALClassName() %>(); ??????? public? int Add<%= GetModelClassName() %>(<%= GetModelClassName() %> <%= GetModelParamName() %>) ??????? { ???<% ???if(TargetTable.ForeignKeyColumns.Count>0) ???{ ????foreach(TableKeySchema key in TargetTable.ForeignKeys) ????{ ?????if(key.PrimaryKeyTable.ExtendedProperties.Contains("DefaultId")) ?????{ ???%> ??????????? if (<%= GetModelParamName() %>.<%= GetFKPropertyName(key) %> == null) ??????????? { ??????????????? <%= GetModelParamName() %>.<%= GetFKPropertyName(key) %> = new <%= 节省页面省去后续大量代码......下载CodeSmith代码模板文件dbmadbll