mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
75 lines
2.6 KiB
Plaintext
75 lines
2.6 KiB
Plaintext
<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
|
|
|
|
<%@ Assembly Src="../Internal/Model.cs" %>
|
|
<%@ Assembly Src="../Internal/Extensions.cs" %>
|
|
|
|
<%@ Import Namespace="System.Collections.Generic" %>
|
|
<%@ Import Namespace="System.Linq" %>
|
|
<%@ Import Namespace="System.Text" %>
|
|
<%@ Import Namespace="System.Text.RegularExpressions" %>
|
|
|
|
<%@ Import Namespace="SchemaMapper" %>
|
|
|
|
<%@ Property Name="Table"
|
|
Type="SchemaExplorer.TableSchema" %>
|
|
|
|
<%@ Property Name="EntityNamespace"
|
|
Type="System.String" %>
|
|
//------------------------------------------------------------------------------
|
|
// <autogenerated>
|
|
// This code was generated by a CodeSmith Template.
|
|
//
|
|
// DO NOT MODIFY contents of this file. Changes to this
|
|
// file will be lost if the code is regenerated.
|
|
// Author:Yubao Li
|
|
// </autogenerated>
|
|
//------------------------------------------------------------------------------
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text;
|
|
using OpenAuth.Repository.Core;
|
|
|
|
namespace <%= EntityNamespace %>
|
|
{
|
|
/// <summary>
|
|
/// <%= Table.Description %>
|
|
/// </summary>
|
|
[Table("<%= Table.Name%>")]
|
|
public partial class <%= Table.Name %> : StringEntity
|
|
{
|
|
public <%= Table.Name %>()
|
|
{
|
|
<% foreach(ColumnSchema p in Table.Columns) {
|
|
if(p.IsPrimaryKeyMember) continue;
|
|
string type = p.SystemType.ToNullableType(p.AllowDBNull == true);
|
|
if(type =="int" || type=="decimal")
|
|
Response.WriteLine(" this."+p.Name+"= 0;");
|
|
else if(type =="string")
|
|
Response.WriteLine(" this."+p.Name+"= string.Empty;");
|
|
else if(type.ToLower().Contains("datetime"))
|
|
Response.WriteLine(" this."+p.Name+"= DateTime.Now;");
|
|
} // foreach %>
|
|
}
|
|
|
|
|
|
<%
|
|
foreach(ColumnSchema p in Table.Columns) {
|
|
if(p.IsPrimaryKeyMember) continue;
|
|
%>
|
|
/// <summary>
|
|
/// <%=p.Description %>
|
|
/// </summary>
|
|
[Description("<%=p.Description%>")]
|
|
<%if(p.Name.LastIndexOf("Id") != -1){%>
|
|
[Browsable(false)]
|
|
<%}%>
|
|
<%if(p.DataType == DbType.Byte){%>
|
|
public bool <%= p.Name%> { get; set; }
|
|
<%}else{%>
|
|
public <%= p.SystemType.ToNullableType(p.AllowDBNull == true) %> <%= p.Name%> { get; set; }
|
|
<%}%>
|
|
<% } // foreach %>
|
|
}
|
|
} |