mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-25 00:50:03 +08:00
54 lines
2.1 KiB
Plaintext
54 lines
2.1 KiB
Plaintext
<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
|
|
<%@ Register Name="TreeApiController" Template="TreeApiController.cst" MergeProperties="False" ExcludeProperties="" %>
|
|
|
|
<%@ Assembly Src="..\..\..\Common\Model.cs" %>
|
|
<%@ Assembly Src="..\..\..\Common\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="Namespace" Type="System.String" %>
|
|
<%@ Property Name="Entity" Type="SchemaMapper.Entity" %>
|
|
<%@ Property Name="Schema" Type="System.String" %>
|
|
<%-- Safe类名 --%>
|
|
<% string SafeClassName = Entity.ClassName.ToSafeName(); %>
|
|
<%-- 描述 --%>
|
|
<% string Description = Entity.Description; %>
|
|
<%-- 如果是树型实体,则调用子模板 --%>
|
|
<%
|
|
if( Entity.IsTreeEntity() ){
|
|
CodeTemplate template = new TreeApiController();
|
|
template.SetProperty("Namespace",Namespace);
|
|
template.SetProperty("Entity",Entity);
|
|
template.SetProperty("Schema",Schema);
|
|
template.Render(this.Response);
|
|
return;
|
|
}
|
|
%>
|
|
using Util.Webs.Controllers;
|
|
using <%= string.Format("{0}.Service.Dtos.{1}",Namespace,Entity.TableSchema) %>;
|
|
using <%= string.Format("{0}.Service.Queries.{1}",Namespace,Entity.TableSchema) %>;
|
|
using <%= string.Format("{0}.Service.Abstractions.{1}",Namespace,Entity.TableSchema) %>;
|
|
|
|
namespace <%= Namespace %>.Apis.<%= Schema %> {
|
|
/// <summary>
|
|
/// <%= Description %>控制器
|
|
/// </summary>
|
|
public class <%= SafeClassName %>Controller : CrudControllerBase<<%= SafeClassName %>Dto, <%= SafeClassName %>Query> {
|
|
/// <summary>
|
|
/// 初始化<%= Description %>控制器
|
|
/// </summary>
|
|
/// <param name="service"><%= Description %>服务</param>
|
|
public <%= SafeClassName %>Controller( I<%= SafeClassName %>Service service ) : base( service ) {
|
|
<%= SafeClassName %>Service = service;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <%= Description %>服务
|
|
/// </summary>
|
|
public I<%= SafeClassName %>Service <%= SafeClassName %>Service { get; }
|
|
}
|
|
} |