예제 #1
0
 /// <summary>
 /// 获取可空float值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static float?ToFloatOrNull(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToFloatOrNull(sqlQuery.ToScalar(connection)));
 }
예제 #2
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(Convert.ToFloatOrNull(await sqlQuery.ToScalarAsync(connection)));
 }
예제 #3
0
 /// <summary>
 /// 获取整型值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static int ToInt(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToInt(sqlQuery.ToScalar(connection)));
 }
예제 #4
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(Convert.ToInt(await sqlQuery.ToScalarAsync(connection)));
 }
예제 #5
0
 /// <summary>
 /// 获取可空日期值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static DateTime?ToDateOrNull(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToDateOrNull(sqlQuery.ToScalar(connection)));
 }
예제 #6
0
 /// <summary>
 /// 获取Guid值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static Guid ToGuid(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToGuid(sqlQuery.ToScalar(connection)));
 }
예제 #7
0
 /// <summary>
 /// 获取日期值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static async Task <DateTime> ToDateAsync(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToDate(await sqlQuery.ToScalarAsync(connection)));
 }
예제 #8
0
 /// <summary>
 /// 获取可空布尔值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static bool?ToBoolOrNull(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToBoolOrNull(sqlQuery.ToScalar(connection)));
 }
예제 #9
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(Convert.ToDecimal(await sqlQuery.ToScalarAsync(connection)));
 }
예제 #10
0
 /// <summary>
 /// 获取decimal值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static decimal ToDecimal(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToDecimal(sqlQuery.ToScalar(connection)));
 }
예제 #11
0
 /// <summary>
 /// 获取double值
 /// </summary>
 /// <param name="sqlQuery">Sql查询对象</param>
 /// <param name="connection">数据库连接</param>
 public static double ToDouble(this ISqlQuery sqlQuery, IDbConnection connection = null)
 {
     return(Convert.ToDouble(sqlQuery.ToScalar(connection)));
 }