DbEntry.Net3.6 Model from a database table CodeSimth 模板
2009-12-05 14:19
441 查看
<%--
Name: DbEntry.Net3.6
Author: shiningrise@gmail.com
Description: Create DbEntry.Net3.6 Model from a database table
--%>
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Description="Create a list of properties from database table." %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="Table that the object is based on." %>
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lephone.Data.Definition;
using Lephone.Linq;
namespace Wz16.Models //Chang it to you namespace string
{
/// <summary>
/// <%= this.SourceTable.Description %>
/// </summary>
[DbTable("<%= this.SourceTable.Name %>")]
public abstract class <%= StringUtil.ToPascalCase(this.SourceTable.Name) %> : LinqObjectModel< <%= StringUtil.ToPascalCase(this.SourceTable.Name) %>>
{
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
<% if( StringUtil.ToPascalCase(column.Name) != "Id" ) {%>
/// <summary>
/// <%= column.Description %>
/// </summary>
<%if( CSharpAlias[column.SystemType.FullName] == "string" ) {%>
[Length(<%= column.Size %>)] <% if( column.AllowDBNull ) { %>[AllowNull] <% } %>public abstract <%= CSharpAlias[column.SystemType.FullName] %> <%= StringUtil.ToPascalCase(column.Name) %> { get; set; }
<% } else { %>
public abstract <%= CSharpAlias[column.SystemType.FullName] %> <% if( column.AllowDBNull ) { %>? <% } %><%= StringUtil.ToPascalCase(column.Name) %> { get; set; }
<% } %>
<% } %>
<% } %>
}
}
Name: DbEntry.Net3.6
Author: shiningrise@gmail.com
Description: Create DbEntry.Net3.6 Model from a database table
--%>
<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Description="Create a list of properties from database table." %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="Table that the object is based on." %>
<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lephone.Data.Definition;
using Lephone.Linq;
namespace Wz16.Models //Chang it to you namespace string
{
/// <summary>
/// <%= this.SourceTable.Description %>
/// </summary>
[DbTable("<%= this.SourceTable.Name %>")]
public abstract class <%= StringUtil.ToPascalCase(this.SourceTable.Name) %> : LinqObjectModel< <%= StringUtil.ToPascalCase(this.SourceTable.Name) %>>
{
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
<% if( StringUtil.ToPascalCase(column.Name) != "Id" ) {%>
/// <summary>
/// <%= column.Description %>
/// </summary>
<%if( CSharpAlias[column.SystemType.FullName] == "string" ) {%>
[Length(<%= column.Size %>)] <% if( column.AllowDBNull ) { %>[AllowNull] <% } %>public abstract <%= CSharpAlias[column.SystemType.FullName] %> <%= StringUtil.ToPascalCase(column.Name) %> { get; set; }
<% } else { %>
public abstract <%= CSharpAlias[column.SystemType.FullName] %> <% if( column.AllowDBNull ) { %>? <% } %><%= StringUtil.ToPascalCase(column.Name) %> { get; set; }
<% } %>
<% } %>
<% } %>
}
}
相关文章推荐
- DbEntry.Net3.6 DbEntryDataSource from a database table CodeSimth 模板
- DbEntry.Net 3.6
- DbEntry.Net 3.6
- DBSPI40-1: Unable to fetch data from table 'V$SYSSTAT' [ORA-03135: connection lost contact]
- org.dbunit.database.AmbiguousTableNameException异常
- 使用firebird2.1与dbEntry.net做的设备报修小程序
- 从数据库表中检索所有行20.5.4.Retrieving All Rows from a Database Table
- org.dbunit.database.ambiguoustablenameexception
- Import Data from *.xlsx file to DB Table through OAF page(转)
- Displaying image from database... (copy from ASP.NET Forums)
- .NET/ASP.NETMVC 深入剖析 Model元数据、HtmlHelper、自定义模板、模板的装饰者模式(二)
- SQL to select a random row from a database table
- .NET/ASP.NETMVC 深入剖析 Model元数据、HtmlHelper、自定义模板、模板的装饰者模式2
- ASP.NET MVC的Model元数据与Model模板:模板的获取与执行策略
- 压缩Microsoft Access database from .NET
- Asp.net mvc + .net ef database first 或 model first 时如何添加验证特性
- Entity Framework – Update Model From Database, Part 2
- Displaying image from database... (copy from ASP.NET Forums)
- An association from the table student refers to an unmapped class: com.test.model.Team
- PD Update Model from database, Unable to list the users.