[C#] 한 걸음 한 걸음 자신의 자동 코드 생성 도구 개발 6: 업무층 템플릿
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Text;
using <xsl:value-of select="TabelModel/NameSpacePri"/>Model;
using <xsl:value-of select="TabelModel/NameSpacePri"/>DAL;
namespace <xsl:value-of select="TabelModel/NameSpacePri"/>BLL
{
public partial class <xsl:value-of select="TabelModel/ModelName"/>BLL
{
#region /
/// <summary>
///
/// </summary>
private <xsl:value-of select="TabelModel/ModelName"/>DAL DAL = null;
/// <summary>
///
///</summary>
public <xsl:value-of select="TabelModel/ModelName"/>BLL()
{
DAL = new <xsl:value-of select="TabelModel/ModelName"/>DAL();
}
#endregion
#region
<xsl:if test="TabelModel/HasPK = 'true'">
/// <summary>
///
///</summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true']">
/// <param><xsl:attribute name="name"><xsl:value-of select="VarName"/></xsl:attribute> <xsl:value-of select="VarName"/></param>
</xsl:for-each>
/// <returns>True/False</returns>
public bool ExistsWithPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.ExistsWithPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
<xsl:if test="TabelModel/HasLogicKey = 'true'">
/// <summary>
///
///</summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true']">
/// <param><xsl:attribute name="name"><xsl:value-of select="VarName"/></xsl:attribute> <xsl:value-of select="VarName"/></param>
</xsl:for-each>
/// <returns>True/False</returns>
public bool ExistsWithLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.ExistsWithLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
/// <summary>
///
///</summary>
/// <param name="strWhere"> ( “Where” )</param>
/// <returns>True/False</returns>
public bool ExistsWithParam(string strWhere)
{
return DAL.ExistsWithParam(strWhere);
}
#endregion
#region
<xsl:if test="TabelModel/HasPK = 'true'">
/// <summary>
///
/// </summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true']">
/// <param>
<xsl:attribute name="name">
<xsl:value-of select="VarName"/>
</xsl:attribute>
<xsl:value-of select="VarName"/>
</param>
</xsl:for-each>
/// <returns> </returns>
public <xsl:value-of select="TabelModel/ModelName"/>Model Get<xsl:value-of select="TabelModel/ModelName"/>ByPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.Get<xsl:value-of select="TabelModel/ModelName"/>ByPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
<xsl:if test="TabelModel/HasLogicKey = 'true'">
/// <summary>
///
/// </summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true']">
/// <param>
<xsl:attribute name="name">
<xsl:value-of select="VarName"/>
</xsl:attribute>
<xsl:value-of select="VarName"/>
</param>
</xsl:for-each>
/// <returns> </returns>
public <xsl:value-of select="TabelModel/ModelName"/>Model Get<xsl:value-of select="TabelModel/ModelName"/>ByLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.Get<xsl:value-of select="TabelModel/ModelName"/>ByLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
/// <summary>
///
/// </summary>
/// <param name="strWhere"> </param>
/// <returns> </returns>
public <xsl:value-of select="TabelModel/ModelName"/>Model Get<xsl:value-of select="TabelModel/ModelName"/>ByParam(string strWhere)
{
return DAL.Get<xsl:value-of select="TabelModel/ModelName"/>ByParam(strWhere);
}
<xsl:if test="TabelModel/HasPK = 'true'">
/// <summary>
/// (DataRow)
/// </summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true']">
/// <param>
<xsl:attribute name="name">
<xsl:value-of select="VarName"/>
</xsl:attribute>
<xsl:value-of select="VarName"/>
</param>
</xsl:for-each>
/// <returns> </returns>
public DataRow GetRowByPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.GetRowByPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
<xsl:if test="TabelModel/HasLogicKey = 'true'">
/// <summary>
/// (DataRow)
/// </summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true']">
/// <param>
<xsl:attribute name="name">
<xsl:value-of select="VarName"/>
</xsl:attribute>
<xsl:value-of select="VarName"/>
</param>
</xsl:for-each>
/// <returns> </returns>
public DataRow GetRowByLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.GetRowByLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
/// <summary>
/// (DataRow)
/// </summary>
/// <param name="strWhere"> </param>
/// <returns> </returns>
public DataRow GetRowByParam(string strWhere)
{
return DAL.GetRowByParam(strWhere);
}
/// <summary>
///
/// </summary>
/// <returns> </returns>
public List<xsl:text disable-output-escaping="yes"><</xsl:text><xsl:value-of select="TabelModel/ModelName"/>Model<xsl:text disable-output-escaping="yes">></xsl:text> Get<xsl:value-of select="TabelModel/ModelName"/>List()
{
return DAL.Get<xsl:value-of select="TabelModel/ModelName"/>List();
}
/// <summary>
///
/// </summary>
/// <param name="strWhere"> </param>
/// <returns> </returns>
public List<xsl:text disable-output-escaping="yes"><</xsl:text><xsl:value-of select="TabelModel/ModelName"/>Model<xsl:text disable-output-escaping="yes">></xsl:text> Get<xsl:value-of select="TabelModel/ModelName"/>ListByParam(string strWhere)
{
return DAL.Get<xsl:value-of select="TabelModel/ModelName"/>ListByParam(strWhere);
}
/// <summary>
/// (DataTable)
/// </summary>
/// <returns> </returns>
public DataTable GetTable()
{
return DAL.GetTableByParam(String.Empty);
}
/// <summary>
/// (DataTable)
/// </summary>
/// <param name="strWhere"> </param>
/// <returns> </returns>
public DataTable GetTableByParam(string strWhere)
{
return DAL.GetTableByParam(strWhere);
}
#endregion
<xsl:if test="TabelModel/IsView = 'false'">
#region / /
/// <summary>
///
///</summary>
/// <param name="model"> </param>
/// <returns></returns>
public int Add<xsl:value-of select="TabelModel/ModelName"/>(<xsl:value-of select="TabelModel/ModelName"/>Model model)
{
return DAL.Add<xsl:value-of select="TabelModel/ModelName"/>(model);
}
<xsl:if test="TabelModel/HasPK = 'true'">
/// <summary>
///
/// </summary>
/// <param name="model"> </param>
/// <returns></returns>
public int Update<xsl:value-of select="TabelModel/ModelName"/>(<xsl:value-of select="TabelModel/ModelName"/>Model model)
{
return DAL.Update<xsl:value-of select="TabelModel/ModelName"/>(model);
}
/// <summary>
///
/// </summary>
/// <param name="model"> </param>
/// <returns></returns>
public int Delete<xsl:value-of select="TabelModel/ModelName"/>(<xsl:value-of select="TabelModel/ModelName"/>Model model)
{
return DAL.Delete<xsl:value-of select="TabelModel/ModelName"/>(model);
}
/// <summary>
///
/// </summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true']">
/// <param>
<xsl:attribute name="name">
<xsl:value-of select="VarName"/>
</xsl:attribute>
<xsl:value-of select="VarName"/>
</param>
</xsl:for-each>
/// <returns></returns>
public int DeleteWithPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.DeleteWithPK(<xsl:value-of select="TabelModel/Fields/FieldModel[IsPK = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsPK = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
<xsl:if test="TabelModel/HasLogicKey = 'true'">
/// <summary>
/// ( )
/// </summary>
/// <param name="model"> </param>
/// <returns></returns>
public int Update<xsl:value-of select="TabelModel/ModelName"/>WithLogicKey(<xsl:value-of select="TabelModel/ModelName"/>Model model)
{
return DAL.Update<xsl:value-of select="TabelModel/ModelName"/>WithLogicKey(model);
}
/// <summary>
/// ( )
/// </summary>
/// <param name="model"> </param>
/// <returns></returns>
public int Delete<xsl:value-of select="TabelModel/ModelName"/>WithLogicKey(<xsl:value-of select="TabelModel/ModelName"/>Model model)
{
return DAL.Delete<xsl:value-of select="TabelModel/ModelName"/>WithLogicKey(model);
}
/// <summary>
///
/// </summary>
<xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true']">
/// <param>
<xsl:attribute name="name">
<xsl:value-of select="VarName"/>
</xsl:attribute>
<xsl:value-of select="VarName"/>
</param>
</xsl:for-each>
/// <returns></returns>
public int DeleteWithLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarType"/><xsl:text> </xsl:text><xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarType"/><xsl:text> </xsl:text><xsl:value-of select="VarName"/></xsl:for-each>)
{
return DAL.DeleteWithLogicKey(<xsl:value-of select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][1]/VarName"/><xsl:for-each select="TabelModel/Fields/FieldModel[IsLogicKey = 'true'][position()>1]">, <xsl:value-of select="VarName"/></xsl:for-each>);
}
</xsl:if>
/// <summary>
///
/// </summary>
/// <param name="strWhere"> </param>
/// <returns> </returns>
public int DeleteByParam(string strWhere)
{
return DAL.DeleteByParam(strWhere);
}
#endregion
</xsl:if>
}
}
</xsl:template>
</xsl:stylesheet>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Access Request, Session and Application in Struts2If we want to use request, Session and application in JSP, what should we do? We can obtain Map type objects such as Req...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.