Esempio n. 1
0
        public static async Task <object> ExecuteScalarAsync(DbType type, System.Data.IDbTransaction transaction, string sql)
        {
            if (DebugMode)
            {
                Console.WriteLine(sql);
            }

            switch (type)
            {
            case DbType.MySql:
                return(await MySqlHelper.ExecuteScalarAsync(transaction, sql));

            case DbType.SqlServer:
                return(await SqlServerHelper.ExecuteScalarAsync(transaction, sql));

            case DbType.PostgreSql:
                return(await PgSqlHelper.ExecuteScalarAsync(transaction, sql));

            case DbType.Sqlite:
                return(await SqliteHelper.ExecuteScalarAsync(transaction, sql));

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 2
0
        public static async Task <IEnumerable <T> > QueryAsync <T>(DbType type, string connectionString, string sql)
        {
            if (DebugMode)
            {
                Console.WriteLine(sql);
            }

            switch (type)
            {
            case DbType.MySql:
                return(await MySqlHelper.QueryAsync <T>(connectionString, sql));

            case DbType.SqlServer:
                return(await SqlServerHelper.QueryAsync <T>(connectionString, sql));

            case DbType.PostgreSql:
                return(await PgSqlHelper.QueryAsync <T>(connectionString, sql));

            case DbType.Sqlite:
                return(await SqliteHelper.QueryAsync <T>(connectionString, sql));

            default:
                throw new NotImplementedException();
            }
        }