Пример #1
0
 /// <summary>
 /// 获取匿名对象
 /// </summary>
 /// <param name="where">条件(以 AND 开头)</param>
 /// <param name="show">显示字段</param>
 /// <returns></returns>
 public IEnumerable <dynamic> GetDynamic(string where, string show = "")
 {
     GetSelectSql(where, show);
     return(DbClient.Query <dynamic>(SqlString.ToString()));
 }
Пример #2
0
 /// <summary>
 /// 获取数据列表
 /// </summary>
 /// <param name="where">条件(以 AND 开头)</param>
 /// <param name="show">显示字段</param>
 /// <returns></returns>
 public IEnumerable <T> GetModelList(string where, string show = "")
 {
     GetSelectSql(where, show);
     return(DbClient.ExecuteScalar <IEnumerable <T> >(SqlString.ToString()));
 }
Пример #3
0
 /// <summary>
 /// 获取一条数据
 /// </summary>
 /// <param name="key">主键OR自增键</param>
 /// <param name="value">值</param>
 /// <param name="show">显示字段</param>
 /// <returns></returns>
 public T GetModel(string key, object value, string show = "")
 {
     GetSelectSql(key, value, show);
     return(DbClient.Query <T>(SqlString.ToString()).FirstOrDefault());
 }
Пример #4
0
 /// <summary>
 /// 直接执行一条SQL
 /// </summary>
 /// <param name="sql"></param>
 /// <returns></returns>
 public IEnumerable <T> GetModelListBySql(string sql)
 => DbClient.Query <T>(sql);
Пример #5
0
 /// <summary>
 /// 简单查询 (单个条件)
 /// </summary>
 /// <param name="field">筛选字段</param>
 /// <param name="value">筛选值</param>
 /// <param name="show">显示字段</param>
 /// <returns></returns>
 public IEnumerable <T> GetModelList(string field, object value, string show = "")
 {
     GetSelectSql(field, value, show);
     return(DbClient.Query <T>(SqlString.ToString()));
 }