zoukankan      html  css  js  c++  java
  • DbEntry.Net3.6 Model from a database table CodeSimth 模板

    <%-- 
    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) %> { getset; }
            
            
    <% } else { %>
            
    public abstract <%= CSharpAlias[column.SystemType.FullName] %> <% if( column.AllowDBNull ) { %>? <% } %><%= StringUtil.ToPascalCase(column.Name) %> { getset; }    
            
    <% } %>
            
        
    <% } %>
    <% } %>
        }
    }
  • 相关阅读:
    .net framework 3.5 和 4.0 的结构图以及Namespaces参考,强烈推荐下载了解!
    ASP.NET操作简单的xml,增删改查
    Http协议详解版本一
    asp.net ToString()格式汇总
    UC首页图片切换
    vs2005部署错误解决方法:ASPNETMERGE : error 1013: Cannot find any assemblies that can be merged in the application bin folder.
    ADO.net,Linq to SQL和Entity Framework性能实测分析
    vs2010下载地址
    如何使用iReaper来下载微软视频教程
    面试经典70题
  • 原文地址:https://www.cnblogs.com/shiningrise/p/1617529.html
Copyright © 2011-2022 走看看