/// <summary>
 /// This constructor is called by the client to create the data source.
 /// </summary>
 public InjectionDbSet(BlindSqlInjection injection, QualifiedName table)
 {
     Provider   = new InjectionQueryProvider(injection, table);
     Expression = Expression.Constant(this);
     Injection  = injection;
     Table      = table;
     Operators  = new Collection <ResultOperatorBase>();
 }
        /// <summary>
        /// This constructor is called by Provider.CreateQuery().
        /// </summary>
        /// <param name="expression"></param>
        public InjectionDbSet(InjectionQueryProvider provider, Expression expression, BlindSqlInjection injection, QualifiedName table, ICollection <ResultOperatorBase> operators)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            if (!typeof(IQueryable <TData>).IsAssignableFrom(expression.Type))
            {
                throw new ArgumentOutOfRangeException("expression");
            }

            Provider   = provider;
            Expression = expression;
            Injection  = injection;
            Table      = table;
            Operators  = operators;
        }
 public MySqlDbContext(BlindSqlInjection injection)
 {
     Injection = injection;
     Users     = new InjectionDbSet <User>(Injection, new QualifiedName("mysql", "user"));
 }
 public MySqlInjectionContext(BlindSqlInjection injection)
 {
     Injection = injection;
 }
 public InformationSchemaDbContext(BlindSqlInjection injection)
 {
     Injection = injection;
     Tables    = new InjectionDbSet <Table>(Injection, new QualifiedName("information_schema", "tables"));
     Columns   = new InjectionDbSet <Column>(Injection, new QualifiedName("information_schema", "columns"));
 }
 public InjectionQueryProvider(BlindSqlInjection injection, QualifiedName table)
 {
     Injection = injection;
     Table     = table;
     Operators = new Collection <ResultOperatorBase>();
 }
        public static Task <int> CountAsync <T>(this IQueryable <T> query, int estimation = 1000)
        {
            BlindSqlInjection injection = (query as IInjectionDbSet).Injection;

            return(injection.GetExpressionValueUsingBinarySearchAsync(injection.Context.Dual.Select(_ => query.Count()), estimation));
        }