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.
 
 
 
 
 

67 lines
2.0 KiB

<%@ CodeTemplate Language="C#" ClassName="OrmService" 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.Service\\"+tb.ModuleName+"\\"+tb.PropertyName+"Service.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;
using EC.Entity.<%=tb.ModuleName%>;
using EC.Util;
using EC.Util.Extension;
namespace EC.Service.<%=tb.ModuleName%>
{
/// <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>
public class <%=tb.PropertyName%>Service : MvcService<<%=tb.PropertyName%>Entity>
{
public override string GetCondition(string queryJson){
string where = "1=1";
var queryParam = queryJson.ToJObject();
return where;
}
/// <summary>
/// <%="\u4fdd\u5b58\u8868\u5355\uff08\u65b0\u589e\u3001\u4fee\u6539\uff09"%>
/// </summary>
/// <param name="keyValue"><%="\u4e3b\u952e\u503c"%></param>
/// <param name="entity"><%="\u5b9e\u4f53\u5bf9\u8c61"%></param>
/// <returns>Id </returns>
public override int SaveForm(string keyValue, <%=tb.PropertyName%>Entity entity)
{
if (string.IsNullOrEmpty(keyValue))
{
entity.Create();
}
else
{
entity.Modify();
}
return base.SaveForm(keyValue, entity);
}
}
}
<%
CloseResponse();
}
%>