IQueryable <TElement> IQueryProvider.CreateQuery <TElement>(Expression expression) { // // Here we're on the edge between IQbservable and IQueryable for the local // execution case. E.g.: // // observable.AsQbservable().<operators>.ToQueryable() // // This should be turned into a local execution, with the push-to-pull // adapter in the middle, so we rewrite to: // // observable.AsQbservable().<operators>.ToEnumerable().AsQueryable() // if (!(expression is MethodCallExpression call) || call.Method.DeclaringType != typeof(Qbservable) || call.Method.Name != nameof(Qbservable.ToQueryable)) { throw new ArgumentException(Strings_Providers.EXPECTED_TOQUERYABLE_METHODCALL, nameof(expression)); } // // This is the IQbservable<T> object corresponding to the lhs. Now wrap // it in two calls to get the local queryable. // var arg0 = call.Arguments[0]; var res = Expression.Call( AsQueryable.MakeGenericMethod(typeof(TElement)), Expression.Call( typeof(Observable).GetMethod(nameof(Observable.ToEnumerable)) !.MakeGenericMethod(typeof(TElement)), arg0 ) ); // // Queryable operator calls should be taken care of by the provider for // LINQ to Objects. So we compile and get the resulting IQueryable<T> // back to hand it out. // return(Expression.Lambda <Func <IQueryable <TElement> > >(res).Compile()()); }
public bool CodigoBarraExiste(string codigoBarra) { var query = AsQueryable.FirstOrDefault(x => x.CodigoBarra == codigoBarra); return(query != null); }
public ProdutoEntity GetByCodigoBarras(string codigoBarra) { var result = AsQueryable.FirstOrDefault(x => x.CodigoBarra == codigoBarra); return(result); }
public int ProdutoTotalPedidos(Guid produtoId) { var result = AsQueryable.Where(x => x.Produtos.Any(y => y.Id == produtoId)); return(result.Count()); }
public bool CodigoExsite(string codigo) { var first = AsQueryable.FirstOrDefault(x => x.Codigo == codigo); return(first != null); }
public List <PureMongoDynamicRecord> GetResult() { return(AsQueryable.ToList()); }
public int ClienteTotalPedidos(Guid clienteId) { var result = AsQueryable.Where(x => x.ClienteId == clienteId); return(result.Count()); }
public TEntity FirstOrDefault(Expression <Func <TEntity, bool> > predicate = null) { return(AsQueryable.FirstOrDefault(predicate ?? (x => true))); }
public async Task <TEntity> FirstOrDefaultAsync(Expression <Func <TEntity, bool> > predicate = null) { return(await AsQueryable.FirstOrDefaultAsync(predicate ?? (x => true))); }
public virtual IQueryable <TEntity> Find(Expression <Func <TEntity, bool> > predicate = null) { return(AsQueryable.Where(predicate ?? (x => true))); }
public virtual async Task <TEntity> SingleOrDefaultAsync(Expression <Func <TEntity, bool> > predicate = null) { return(await AsQueryable.SingleOrDefaultAsync(predicate ?? (x => true))); }
public virtual TEntity SingleOrDefault(Expression <Func <TEntity, bool> > predicate = null) { return(AsQueryable.SingleOrDefault(predicate ?? (x => true))); }
public bool CodigoExiste(string codigo) { var entity = AsQueryable.FirstOrDefault(x => x.Codigo == codigo); return entity != null; }
public bool CpfExiste(string cpf) { var entity = AsQueryable.FirstOrDefault(x => x.Cpf == cpf); return entity != null; }