C# 轻量级ORM 编写思维
作者:网络转载 发布时间:[ 2014/5/28 11:25:23 ] 推荐标签:C# ORM 编写思维 net
业务逻辑接口
//name:wujc 2013-06-20
namespace Yc.BLL
{
public class DataDomain : IDataService
{
private readonly IDataService dal = DataAccess.CreateService();
public DataDomain()
{ }
#region 成员方法
/// <summary>
/// 获取表行数
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="strWhere"></param>
/// <returns></returns>
public int GetRowsCount<T>(string strWhere) where T : BaseModel, new() { return dal.GetRowsCount<T>(strWhere); }
/// <summary>
/// 获取表行数
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="sql"></param>
/// <returns></returns>
public int GetRowsCount(string sql) { return dal.GetRowsCount(sql); }
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists<T>(string id) where T : BaseModel, new() { return dal.Exists<T>(id); }
/// <summary>
/// 增加一条数据
/// </summary>
public bool Add<T>(T model) where T : BaseModel, new() { return dal.Add<T>(model); }
/// <summary>
/// 增加多条数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="modelList"></param>
/// <returns></returns>
public bool Add<T>(List<T> modelList) where T : BaseModel, new() { return dal.Add<T>(modelList); }
/// <summary>
/// 更新一条数据
/// </summary>
public bool Update<T>(T model) where T : BaseModel, new() { return dal.Update<T>(model); }
/// <summary>
/// 更新多条数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="model"></param>
/// <returns></returns>
public bool Update<T>(List<T> modelList) where T : BaseModel, new() { return dal.Update<T>(modelList); }
/// <summary>
/// 删除一条数据
/// </summary>
public bool Delete<T>(string id) where T : BaseModel, new() { return dal.Delete<T>(id); }
/// <summary>
/// 删除一条数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
public bool Delete<T>(T model) where T : BaseModel, new() { return dal.Delete<T>(model); }
/// <summary>
/// 删除多条数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="model"></param>
/// <returns></returns>
public bool Delete<T>(List<T> modelList) where T : BaseModel, new() { return dal.Delete<T>(modelList); }
/// <summary>
/// 批量删除数据
/// </summary>
/// <param name="idList">逗号分隔</param>
/// <returns></returns>
public bool DeleteList<T>(string idList) where T : BaseModel, new() { return dal.DeleteList<T>(idList); }
/// <summary>
/// 得到一个对象实体
/// </summary>
public T GetModel<T>(string id) where T : BaseModel, new() { return dal.GetModel<T>(id); }
/// <summary>
/// 得到全部对象实体
/// </summary>
public List<T> GetModelList<T>(string strWhere) where T : BaseModel, new() { return dal.GetModelList<T>(strWhere); }
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList<T>(string strWhere) where T : BaseModel, new() { return dal.GetList<T>(strWhere); }
/// <summary>
/// 获得数据表
/// </summary>
public DataTable GetTable<T>(string strWhere) where T : BaseModel, new() { return dal.GetTable<T>(strWhere); }
/// <summary>
/// 根据分页获得数据列表
/// </summary>
public DataSet GetList<T>(string strWhere, string orderby, int startIndex, int endIndex) where T : BaseModel, new() { return dal.GetList<T>(strWhere, orderby, startIndex, endIndex); }
/// <summary>
/// 根据分页获得数据列表
/// </summary>
public DataSet GetListBySql(string sql, string orderby, int startIndex, int endIndex) { return dal.GetListBySql(sql, orderby, startIndex, endIndex); }
/// <summary>
/// 执行SQL语句,返回影响的记录数
/// </summary>
/// <param name="SQLString">SQL语句</param>
/// <returns>影响的记录数</returns>
public int ExecuteSql(string SQLString) { return dal.ExecuteSql(SQLString); }
/// <summary>
/// 执行查询语句,返回DataSet
/// </summary>
/// <param name="SQLString">查询语句</param>
/// <returns>DataSet</returns>
public DataSet Query(string SQLString) { return dal.Query(SQLString); }
/// <summary>
/// 执行多条SQL语句,实现数据库事务。
/// </summary>
/// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])</param>
public void ExecuteSqlTran(Hashtable SQLStringList) { dal.ExecuteSqlTran(SQLStringList); }
#endregion 成员方法
|
因为这还是个公司框架,还不能开源,不过看完以上接口定义之后,已经知道个大概了吧。
本文内容不用于商业目的,如涉及知识产权问题,请权利人联系SPASVO小编(021-61079698-8054),我们将立即处理,马上删除。
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11热门文章
常见的移动App Bug??崩溃的测试用例设计如何用Jmeter做压力测试QC使用说明APP压力测试入门教程移动app测试中的主要问题jenkins+testng+ant+webdriver持续集成测试使用JMeter进行HTTP负载测试Selenium 2.0 WebDriver 使用指南