You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.2 KiB
96 lines
2.2 KiB
1 year ago
|
<%@ CodeTemplate Language="C#" ClassName="ModelOrm" TargetLanguage="C#" Debug="False" Description="" encoding="GB2312" %>
|
||
|
<%@ Property Name="databaseProjectName" Type="System.String" Default="SpSampleDb" Optional="True" Category="Context" Description="" %>
|
||
|
<%@ Property Name="nameSpace" Type="System.String" Default="Model" Optional="True" Category="Context" Description="" %>
|
||
|
<%
|
||
|
DbEntity db = Template.GetDataBase(databaseProjectName);
|
||
|
foreach(Table tb in db.Tables)
|
||
|
{
|
||
|
OpenResponse(databaseProjectName+"\\ModelOrm\\"+tb.ModuleName+"\\"+tb.PropertyName+".cs");
|
||
|
string pkParmList = "";
|
||
|
foreach(Field fd in tb.Fields)
|
||
|
{
|
||
|
if(fd.IsPK == true)
|
||
|
pkParmList += fd.DataType.DotNetType+" "+fd.MemberName+",";
|
||
|
}
|
||
|
pkParmList = pkParmList.Trim(',');
|
||
|
%>
|
||
|
using System;
|
||
|
using System.Data;
|
||
|
|
||
|
|
||
|
/*******************************************************/
|
||
|
/*Project:
|
||
|
Module :
|
||
|
Description :
|
||
|
Date : <%=DateTime.Now.ToString()%>
|
||
|
Create : Lxc
|
||
|
Update :
|
||
|
TODO : */
|
||
|
/*******************************************************/
|
||
|
|
||
|
namespace EC.Entity
|
||
|
{
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// <%=tb.CnName%>
|
||
|
/// </summary>
|
||
|
[TableNameAttribute("tab<%=tb.TableSpace.ToLower()+tb.PropertyName.ToLower()%>")]
|
||
|
[ViewNameAttribute("v_<%=tb.PropertyName.ToLower()%>")]
|
||
|
public class <%=tb.PropertyName%>Entity
|
||
|
{
|
||
|
#region <%=tb.PropertyName%>Entity
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public <%=tb.PropertyName%>Entity()
|
||
|
{
|
||
|
}
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
public <%=tb.PropertyName%>Entity(<%=pkParmList%>)
|
||
|
{
|
||
|
<%
|
||
|
foreach(Field fd in tb.Fields)
|
||
|
if(fd.IsPK == true)
|
||
|
Response.WriteLine("\t\t\tthis."+fd.MemberName+" = "+fd.MemberName+";");
|
||
|
%>
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
//[FieldNameAttribute("pay_key", "VarChar")]
|
||
|
<%--Field--%>
|
||
|
<%
|
||
|
foreach(Field fd in tb.Fields)
|
||
|
{
|
||
|
%>
|
||
|
|
||
|
/// <summary>
|
||
|
/// <%=fd.CnName%>
|
||
|
<%
|
||
|
if( fd.Note != "" && fd.Note!= null)
|
||
|
Response.WriteLine("\t\t/// "+fd.Note.Replace("\r\n"," ").Replace("\r"," ").Replace("\n"," "));
|
||
|
if( fd.Identity.Enable == true)
|
||
|
Response.WriteLine("\t\t/// AutoInc");
|
||
|
if( fd.IsPK == true)
|
||
|
Response.WriteLine("\t\t/// PK");
|
||
|
%> /// </summary>
|
||
|
public <%=fd.DataType.DotNetType%> <%=fd.MemberName%>{ get; set; }
|
||
|
|
||
|
<%
|
||
|
}
|
||
|
%><%--Field End--%>
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<%
|
||
|
CloseResponse();
|
||
|
}
|
||
|
%>
|