标签:
一步步完善并优化自己的ORM框架功能
[新增] /// <summary> /// 根据查询实体获取指定返回列的值 /// </summary> /// <typeparam name="SearchT">查询实体类</typeparam> /// <typeparam name="ResultT">返回实体类</typeparam> /// <param name="searchEntity">查询实体</param> /// <param name="resultEntity">返回实体</param> /// <param name="dataBaseName">库名</param> /// <param name="tableName">表名</param> /// <param name="selectExpressions">返回属性表达式</param> /// <returns>sql参数集合</returns> public static List<ResultT> GetListBySelectExpression<SearchT, ResultT>(SearchT searchEntity, ResultT resultEntity, string dataBaseName, string tableName = "", params Expression<Func<ResultT, object>>[] selectExpressions) where ResultT : EntityBase, new() { //返回的结果集 List<ResultT> resultList = new List<ResultT>(); string sql = string.Empty; Dictionary<string, PropertyInfo> propertieList = GetProperties(resultEntity.GetType()); var pars = GetQuerySqlBySelectExpression(searchEntity, resultEntity, out sql, tableName, selectExpressions); if (!string.IsNullOrEmpty(sql) && pars != null && pars.Count > 0) { resultList = GetExecuteResultTesk<ResultT>(sql, pars, propertieList, dataBaseName); pars.Clear(); } return resultList; }
标签:
原文地址:http://www.cnblogs.com/stevenchen2016/p/5468887.html