21岁就死的数学天才:BLL 业务逻辑层代码生成器

来源:百度文库 编辑:偶看新闻 时间:2024/05/02 08:44:45

<%--
Name:
Author:
Description:
--%>
<%@ CodeTemplate Language="C#" TargetLanguage="Text" Src="" Inherits="" Debug="False" Description="Template description here." %>
<%@ Property Name="SampleStringProperty" Type="System.String" Default="SomeValue" Optional="True" Category="Strings" Description="This is a sample string property." %>
<%@ Property Name="SampleBooleanProperty" Type="System.Boolean" Default="True" Optional="False" Category="Booleans" Description="This is a sample boolean property." %>
<%@ Assembly Name="System.Data" %>
<%@ Import Namespace="System.Data" %>
<%@ Property Name="nameSpace" Type="String" Default="Eatery" Optional="False" Category="" Description="" OnChanged="" Editor="" EditorBase="" Serializer="" %>
<%@ Property Name="index" Type="System.int32" Default="0" Optional="False" Category="" Description="" OnChanged="" Editor="" EditorBase="" Serializer="" %>
<%@ Property Name="db" Type="SchemaExplorer.DatabaseSchema" Default="" Optional="False" Category="Context" Description="???" OnChanged="" Editor="" EditorBase="" Serializer="" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<%@ Import Namespace="System.IO" %>
using System;
using System.Data.Common;
using System.Collections.Generic;
using System.Text;
using Model;
using <%=nameSpace %>DAL;

namespace <%=nameSpace %>BLL
{
 public class <%=GetClassName() %>BLL
 {
  private <%=GetClassName() %>DAL <%=GetObjectName() %>DAL = new <%=GetClassName() %>DAL();
  
  public int Add(<%=GetClassName() %> <%=GetObjectName() %>)
        {
            return <%=GetObjectName() %>DAL.Add(<%=GetObjectName() %>);
        }
  
  public int AddReturn<%=StringUtil.ToPascalCase(db.Tables[index].Columns[0].Name) %>(<%=GetClassName() %> <%=GetObjectName() %>)
        {
            return <%=GetObjectName() %>DAL.AddReturn<%=StringUtil.ToPascalCase(db.Tables[index].Columns[0].Name) %>(<%=GetObjectName() %>);
        }
  
  public int Update(<%=GetClassName() %> <%=GetObjectName() %>)
  {
   return <%=GetObjectName() %>DAL.Update(<%=GetObjectName() %>);
  }
  
  public int Delete(int <%=StringUtil.ToCamelCase(GetPrimaryKey()) %>)
  {
   return <%=GetObjectName() %>DAL.Delete(<%=StringUtil.ToCamelCase(GetPrimaryKey()) %>);
  }
 
  public List<<%=GetClassName() %>> GetAll()
  {
   return <%=GetObjectName() %>DAL.GetAll();
  }
  
  public <%=GetClassName() %> GetSingle(int <%=StringUtil.ToCamelCase(GetPrimaryKey()) %>)
        {
            return <%=GetObjectName() %>DAL.GetSingle(<%=StringUtil.ToCamelCase(GetPrimaryKey()) %>);
  }
  
  public List<<%=GetClassName() %>> GetAllByConditions(string conditions)
  {
   return <%=GetObjectName() %>DAL.GetAllByConditions(conditions);
  }
 }
}