DT 的数据字典
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.

138 lines
3.9 KiB

1 year ago
<%@ CodeTemplate Language="C#" ClassName="OrmEntity" 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+"\\EC.Entity\\"+tb.ModuleName+"\\"+tb.PropertyName+"Entity.cs");
string pkParmList = "";
foreach(Field fd in tb.Fields)
{
if(fd.IsPK == true)
pkParmList += fd.DataType.DotNetType+" "+fd.MemberName+",";
}
pkParmList = pkParmList.Trim(',');
string tablename=tb.TableSpace.ToLower() +tb.MemberName.ToLower();
%>
using System;
using System.Data;
/// <summary>
/// <%="\u7248\u0020\u672c\u0020"%>: 10.0
/// Copyright :(c) 2003-2019 <%="\u7cbe\u8bda\u8f6f\u4ef6"%>
/// <%="\u521b\u0020\u5efa"%> : LXC
/// <%="\u65e5\u0020\u671f"%> : <%=DateTime.Now.ToString()%>
/// <%="\u63cf\u0020\u8ff0"%> : <%=tb.CnName%>
/// </summary>
namespace EC.Entity.<%=tb.ModuleName%>
{
/// <summary>
/// <%=tb.CnName%>
/// </summary>
[TableNameAttribute("<%=tablename%>")]
[ViewNameAttribute("v_<%=tablename%>")]
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>
<%
if( fd.IsPK == true)
Response.WriteLine("[TableKeyAttribute(\"key\")]");
%> public <%=fd.DataType.DotNetType%> <%=fd.MemberName%>{ get; set; }
<%
}
%><%--Field End--%>
//
#region <%="\u6269\u5c55\u64cd\u4f5c"%>
public int? IntVal1 { get; set; }
//public int? IntVal2 { get; set; }
//public int? IntVal3 { get; set; }
public string CDefine1 { get; set; }
public string CDefine2 { get; set; }
//public string CDefine3 { get; set; }
public DateTime createdate { get; set; }
public string createuserid { get; set; }
public string createusername { get; set; }
public DateTime modifydate { get; set; }
public string modifyuserid { get; set; }
public string modifyusername { get; set; }
public string partorg { get; set; }
/// <summary>
/// <%="\u65b0\u589e\u8c03\u7528"%>
/// </summary>
public void Create()
{
this.createdate = DateTime.Now;
this.createuserid = OperatorProvider.UserId;
this.createusername = OperatorProvider.UserName;
this.modifydate = DateTime.Now;
this.modifyuserid = OperatorProvider.UserId;
this.modifyusername = OperatorProvider.UserName;
this.partorg = OperatorProvider.PartOrg;
}
/// <summary>
/// <%="\u7f16\u8f91\u8c03\u7528"%>
/// </summary>
/// <param name="keyValue"></param>
public void Modify()
{
this.modifydate = DateTime.Now;
this.modifyuserid = OperatorProvider.UserId;
this.modifyusername = OperatorProvider.UserName;
}
#endregion
}
}
<%
CloseResponse();
}
%>