internal static Task <List <T> > WhereAsync <T>(this IDbCommand dbCmd, object anonType, CancellationToken token)
        {
            dbCmd.SetFilters <T>(anonType);

            return(OrmLiteReadExtensions.IsScalar <T>()
                ? dbCmd.ColumnAsync <T>(null, token)
                : dbCmd.ConvertToListAsync <T>(null, token));
        }
        internal static Task <T> SingleAsync <T>(this IDbCommand dbCmd, string sql, object anonType, CancellationToken token)
        {
            if (OrmLiteReadExtensions.IsScalar <T>())
            {
                return(dbCmd.ScalarAsync <T>(sql, anonType, token));
            }

            dbCmd.SetParameters <T>(anonType, excludeDefaults: false);

            return(dbCmd.ConvertToAsync <T>(OrmLiteConfig.DialectProvider.ToSelectStatement(typeof(T), null, sql), token));
        }
        internal static Task <List <T> > SqlColumnAsync <T>(this IDbCommand dbCmd, string sql, Dictionary <string, object> dict, CancellationToken token)
        {
            if (dict != null)
            {
                dbCmd.SetParameters(dict, false);
            }
            dbCmd.CommandText = sql;

            return(OrmLiteReadExtensions.IsScalar <T>()
                ? dbCmd.ColumnAsync <T>(null, token)
                : dbCmd.ConvertToListAsync <T>(null, token));
        }
        internal static Task <List <T> > SqlColumnAsync <T>(this IDbCommand dbCmd, string sql, object anonType, CancellationToken token)
        {
            if (anonType != null)
            {
                dbCmd.SetParameters <T>(anonType, excludeDefaults: false);
            }
            dbCmd.CommandText = sql;

            return(OrmLiteReadExtensions.IsScalar <T>()
                ? dbCmd.ColumnAsync <T>(null, token)
                : dbCmd.ConvertToListAsync <T>(null, token));
        }
        internal static Task <List <T> > SelectAsync <T>(this IDbCommand dbCmd, string sql, object anonType, CancellationToken token)
        {
            if (anonType != null)
            {
                dbCmd.SetParameters <T>(anonType, excludeDefaults: false);
            }
            dbCmd.CommandText = OrmLiteConfig.DialectProvider.ToSelectStatement(typeof(T), null, sql);

            return(OrmLiteReadExtensions.IsScalar <T>()
                ? dbCmd.ColumnAsync <T>(null, token)
                : dbCmd.ConvertToListAsync <T>(null, token));
        }
        internal static Task <List <T> > SelectAsync <T>(this IDbCommand dbCmd, string sql, Dictionary <string, object> dict, CancellationToken token)
        {
            if (dict != null)
            {
                dbCmd.SetParameters((IDictionary <string, object>)dict, (bool)false);
            }

            dbCmd.CommandText = OrmLiteConfig.DialectProvider.ToSelectStatement(typeof(T), null, sql);

            return(OrmLiteReadExtensions.IsScalar <T>()
                ? dbCmd.ColumnAsync <T>(null, token)
                : dbCmd.ConvertToListAsync <T>(null, token));
        }
        internal static Task <List <TModel> > SelectFmtAsync <TModel>(this IDbCommand dbCmd, CancellationToken token, Type fromTableType, string sqlFilter, params object[] filterParams)
        {
            var sql = OrmLiteReadExtensions.ToSelectFmt <TModel>(fromTableType, sqlFilter, filterParams);

            return(dbCmd.ConvertToListAsync <TModel>(sql.ToString(), token));
        }
 internal static Task <T> ScalarAsync <T>(this IDataReader reader, CancellationToken token)
 {
     return(OrmLiteConfig.DialectProvider.ReaderRead(reader, () =>
                                                     OrmLiteReadExtensions.ToScalar <T>(reader.GetValue(0)), token));
 }