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; }    
            
    <% } %>
            
        
    <% } %>
    <% } %>
        }
    }
  • 相关阅读:
    mapreduce 函数入门 二
    mapreduce 函数入门 一
    Flume+Kafka+Storm+Redis 大数据在线实时分析
    mapReduce 大数据离线分析
    docker 简介
    flume安装使用+根据数据源分类
    hiho 171周
    如何新建一个空的optix工程
    读 Real-Time Rendering 收获
    hiho 1590
  • 原文地址:https://www.cnblogs.com/shiningrise/p/1617529.html
Copyright © 2011-2022 走看看