/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }