Files
2018-05-01 22:48:12 +08:00

60 lines
2.8 KiB
Plaintext

<%@ Template Language="C#" TargetLanguage="C#" Debug="True" Encoding="UTF-8" %>
<%@ 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="UnitOfWork" Type="System.String" %>
<%@ Property Name="Entity" Type="SchemaMapper.Entity" %>
<%@ Property Name="IUnitOfWorkNamespace" Type="System.String" %>
<%-- Safe类名 --%>
<% string SafeClassName = Entity.ClassName.ToSafeName(); %>
<%-- 描述 --%>
<% string Description = Entity.Description; %>
using Util;
using Util.Maps;
using Util.Domains.Repositories;
using Util.Datas.Queries;
using Util.Applications.Trees;
using <%= string.Format("{0}.Data",Namespace) %>;
using <%= Entity.GetNamespace(Namespace,"Domain","Models") %>;
using <%= Entity.GetNamespace(Namespace,"Domain","Repositories") %>;
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 <%= string.Format("{0}.Service.Implements.{1}",Namespace,Entity.TableSchema) %> {
/// <summary>
/// <%= Description %>服务
/// </summary>
public class <%= SafeClassName %>Service : TreeServiceBase<<%= SafeClassName %>, <%= SafeClassName %>Dto, <%= SafeClassName %>Query<%= Entity.GetKeyTypeNoContainsGuid() %>>, I<%= SafeClassName %>Service {
/// <summary>
/// 初始化<%= Description %>服务
/// </summary>
/// <param name="unitOfWork">工作单元</param>
/// <param name="<%= SafeClassName.ToCamelCase() %>Repository"><%= Description %>仓储</param>
public <%= SafeClassName %>Service( I<%= UnitOfWork %> unitOfWork, I<%= SafeClassName %>Repository <%= SafeClassName.ToCamelCase() %>Repository )
: base( unitOfWork, <%= SafeClassName.ToCamelCase() %>Repository ) {
<%= SafeClassName %>Repository = <%= SafeClassName.ToCamelCase() %>Repository;
}
/// <summary>
/// <%= Description %>仓储
/// </summary>
public I<%= SafeClassName %>Repository <%= SafeClassName %>Repository { get; set; }
/// <summary>
/// 创建查询对象
/// </summary>
/// <param name="param">查询参数</param>
protected override IQueryBase<<%= SafeClassName %>> CreateQuery( <%= SafeClassName %>Query param ) {
return new Query<<%= SafeClassName %><%= Entity.GetKeyTypeNoContainsGuid() %>>( param );
}
}
}