Пример #1
0
 /// <summary>
 /// 获取可空整型值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 /// <returns></returns>
 public static async Task <int?> ToIntOrNullAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Conv.ToIntOrNull(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #2
0
 /// <summary>
 /// 获取字符串值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 /// <returns></returns>
 public static async Task <string> ToStringAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return((await sqlQuery.ToScalarAsync(connection)).SafeString());
 }
Пример #3
0
 /// <summary>
 /// 获取Guid值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 /// <returns></returns>
 public static async Task <Guid> ToGuidAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Conv.ToGuid(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #4
0
 /// <summary>
 /// 获取布尔值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 /// <returns></returns>
 public static async Task <bool> ToBoolAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Conv.ToBool(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #5
0
 /// <summary>
 /// 获取日期值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 /// <returns></returns>
 public static async Task <DateTime> ToDateAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Conv.ToDate(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #6
0
 /// <summary>
 /// 获取可空float值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <float?> ToFloatOrNullAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Util.Helpers.Convert.ToFloatOrNull(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #7
0
 /// <summary>
 /// 获取float值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 /// <returns></returns>
 public static async Task <float> ToFloatAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Conv.ToFloat(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #8
0
 /// <summary>
 /// 获取可空decimal值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <decimal?> ToDecimalOrNullAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToDecimalOrNull(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #9
0
 /// <summary>
 /// 获取整型值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <int> ToIntAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Util.Helpers.Convert.ToInt(await sqlQuery.ToScalarAsync(connection)));
 }
 /// <summary>
 /// 获取整型值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <int> ToIntAsync(this ISqlQuery sqlQuery, IDbConnection connection = null) => Conv.ToInt(await sqlQuery.ToScalarAsync(connection));
Пример #11
0
 /// <summary>
 /// 获取double值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <double> ToDoubleAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToDouble(await sqlQuery.ToScalarAsync(connection)));
 }
 /// <summary>
 /// 获取可空Guid值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <Guid?> ToGuidOrNullAsync(this ISqlQuery sqlQuery, IDbConnection connection = null) => Conv.ToGuidOrNull(await sqlQuery.ToScalarAsync(connection));
 /// <summary>
 /// 获取decimal值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <decimal> ToDecimalAsync(this ISqlQuery sqlQuery, IDbConnection connection = null) => Conv.ToDecimal(await sqlQuery.ToScalarAsync(connection));
Пример #14
0
 /// <summary>
 /// 获取可空Guid值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <Guid?> ToGuidOrNullAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Core.Helpers.Convert.ToGuidOrNull(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #15
0
 /// <summary>
 /// 获取可空日期值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <DateTime?> ToDateOrNullAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Ding.Helpers.Convert.ToDateOrNull(await sqlQuery.ToScalarAsync(connection)));
 }
Пример #16
0
 /// <summary>
 /// 获取decimal值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <decimal> ToDecimalAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Ding.Helpers.Convert.ToDecimal(await sqlQuery.ToScalarAsync(connection)));
 }