OpenAuth.Net/CodeSmith/CSharp/Web/Application.cst

53 lines
1.6 KiB
Plaintext
Raw Normal View History

2017-11-29 18:26:36 +08:00
<%--
Name: Database Table Properties
Author: yubaolee
Description: Create a list of properties from a database table
--%>
<%@ CodeTemplate Language="C#" Encoding="utf-8" TargetLanguage="C#" Debug="False" Description="应用层" %>
<%@ Property Name="ModuleName" Type="String" Category="Context" Description="模块名称" %>
<%@ 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;
2017-12-15 00:03:06 +08:00
using OpenAuth.App.Request;
using OpenAuth.App.Response;
using OpenAuth.App.SSO;
using OpenAuth.Repository.Domain;
2017-11-29 18:26:36 +08:00
namespace OpenAuth.App
{
2017-12-15 00:03:06 +08:00
public class <%=ModuleName%>App : BaseApp<<%=ModuleName%>>
2017-11-29 18:26:36 +08:00
{
2017-12-15 00:03:06 +08:00
public RevelanceManagerApp ReleManagerApp { get; set; }
2017-11-29 18:26:36 +08:00
/// <summary>
2017-12-15 00:03:06 +08:00
/// 加载列表
2017-11-29 18:26:36 +08:00
/// </summary>
2017-12-15 00:03:06 +08:00
public TableData Load(Query<%=ModuleName%>ListReq request)
2017-11-29 18:26:36 +08:00
{
2018-05-28 09:56:37 +08:00
return new TableData
2017-11-29 18:26:36 +08:00
{
2018-05-28 09:56:37 +08:00
count = Repository.GetCount(null),
data = Repository.Find(request.page, request.limit, "Id desc")
2017-11-29 18:26:36 +08:00
};
}
2017-12-15 00:03:06 +08:00
public void Add(<%=ModuleName%> obj)
2017-11-29 18:26:36 +08:00
{
2017-12-15 00:03:06 +08:00
Repository.Add(obj);
2017-11-29 18:26:36 +08:00
}
2017-12-15 00:03:06 +08:00
public void Update(<%=ModuleName%> obj)
2017-11-29 18:26:36 +08:00
{
2017-12-18 22:37:51 +08:00
UnitWork.Update<<%=ModuleName%>>(u => u.Id == obj.Id, u => new <%=ModuleName%>
2017-11-29 18:26:36 +08:00
{
2018-05-28 09:56:37 +08:00
//todo:要修改的字段赋值
2017-12-15 00:03:06 +08:00
});
2017-11-29 18:26:36 +08:00
}
}
2015-11-22 23:54:21 +08:00
}