コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }