<%@ 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 %> { /// /// <%= Description %>控制器 /// public class <%= SafeClassName %>Controller : CrudControllerBase<<%= SafeClassName %>Dto, <%= SafeClassName %>Query> { /// /// 初始化<%= Description %>控制器 /// /// <%= Description %>服务 public <%= SafeClassName %>Controller( I<%= SafeClassName %>Service service ) : base( service ) { <%= SafeClassName %>Service = service; } /// /// <%= Description %>服务 /// public I<%= SafeClassName %>Service <%= SafeClassName %>Service { get; } } }