公司框架BO模板

<%@ CodeTemplate Language="C#" TargetLanguage="T-SQL" Debug="true" CompilerVersion="v3.5" Description="" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Optional="False" Category="Required" %>
<%@ Property Name="NameSpace" Optional="False" Type="System.String" Default="Beyondbit.App.Entity" Category="Style" Description="Object Namespace." %>
//----------------------------------------------------------------
// Copyright (C) 2012 上海互联网软件有限公司
// 版权所有。
// All rights reserved.
//
// 文件名:BO<%=SourceTable.Name%>.cs
// 文件功能描述:
//
//
// 创建标识: <%= DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") %>
//
// 修改标识:
// 修改描述:
//----------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using Beyondbit.Framework.Biz;
using Beyondbit.Framework.Biz.BO;
using Beyondbit.Framework.Core.InterceptorHandler;
using Beyondbit.Framework.DataAccess;
using Beyondbit.Framework.DataAccess.ObjectDAO;
using Beyondbit.DocumentSpare.DAO;
using Beyondbit.DocumentSpare.Entity;
using System.Data;
using Beyondbit.Core.Common.Tools;

<%--
SourceTable.Columns[i].ExtendedProperties[]
==CS_IsRowGuidCol
==CS_IsIdentity
==CS_IsComputed
==CS_IsDeterministic
==CS_IdentitySeed
==CS_IdentityIncrement
==CS_Default
==CS_ComputedDefinition
==CS_Collation
==CS_ObjectID
==CS_SystemType
==CS_UserType
==MS_Description
==CS_Description
--%>

namespace <%=NameSpace%> {

public class BO<%=SourceTable.Name%> : BaseBO {
private DAO<%=SourceTable.Name%> dao = null;

/// <summary>
/// 构造函数初始化变量
/// </summary>
public ExampleBO()
{
dao = new DAO<%=SourceTable.Name%>();
}

/// <summary>
/// 新增
/// </summary>
/// <param name="entity"></param>
[Frame(true, false)]
public virtual void Insert(<%=SourceTable.Name%> entity)
{
try
{
dao.Insert(entity);
}
catch (DalException ex)
{
throw new BOException("调用BO<%=SourceTable.Name%>的Insert方法出错!", ex);
}
}

/// <summary>
/// 修改
/// </summary>
/// <param name="entity"></param>
[Frame(true, false)]
public virtual void Update(<%=SourceTable.Name%> entity)
{
try
{
dao.Update(entity);
}
catch (DalException ex)
{
throw new BOException("调用BO<%=SourceTable.Name%>的Update方法出错!", ex);
}
}

/// <summary>
/// 删除
/// </summary>
/// <param name="entity"></param>
[Frame(true, true)]
public virtual bool Delete(<%=SourceTable.Name%> entity)
{
try
{
return dao.DeleteItem(entity.ID);
}
catch (DalException ex)
{
throw new BOException("调用BO<%=SourceTable.Name%>的Delete方法出错!", ex);
}
}


/// <summary>
///
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[Frame(true, false)]
public virtual <%=SourceTable.Name%> Get(int Id)
{
try
{
return dao.Get(Id);
}
catch (DalException ex)
{
throw new BOException("调用BO<%=SourceTable.Name%>的Get方法出错!", ex);
}
}

/// <summary>
///
/// </summary>
/// <param name="pSearch"></param>
/// <param name="StrCondition"></param>
/// <returns></returns>
[Frame(true, false)]
public virtual SplitPageResult<<%=SourceTable.Name%>> QueryExampleInfo(PageSearch pSearch, string StrCondition)
{
try
{
return dao.Query<%=SourceTable.Name%>(pSearch, StrCondition);
}
catch (DalException ex)
{
throw new BOException("调用BO<%=SourceTable.Name%>的Query<%=SourceTable.Name%>的方法出错!", ex);
}
}
}
}

原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/2803937.html