Questions tagged [asqueryable]

Converts IEnumerable to IQueryable

AsQueryable Converts IEnumerable to IQueryable.

IQueryable is recommended for querying objects at remote source (like from database).

AsQueryable is used when expression tree is to be constructed to query the remote object. So if there are multiple querying constructs, Query execution after AsQueryable, is done remotely, and final result set is returned. If AsQueryable is not used, then all the subsequent queries will be executed one by one (as in pipeline). There will be multiple round-trip between remote source and application.

44 questions
1
vote
1 answer

MondoDB+C#+IQueryable - have an array of strings and how to join it to Mongo's collection in the Where clause

Having quite a small experience with Mongo, please help... I have Employee collection (fields are: FirstName, LastName, Title, etc) in the Mondo DB, using C# MongoDB driver and using the collection as IQueryable so I can search for the data by using…
MagicMax
  • 141
  • 1
  • 11
1
vote
0 answers

Not getting response for query in flink queryable state [version-1.7.2]

I am querying to proxy server of flink cluster which is on 127.0.1.1:9069 but not getting response for query. I am calculating sum of all inputted numbers by creating a server on 9000 port. Also I am storing the sum in Value State. Flink…
1
vote
2 answers

How do I get data from inner array in MongoDB using LINQ's AsQueryable()?

I'm unable to get data from the inner array of in MongoDB. I get the error: BsonSerializationException: No matching creator found. Here's a sample of my data in MongoDB, query, and environment. { "Id" : 1, "compName" : "Samsung…
inquisitive_one
  • 1,465
  • 7
  • 32
  • 56
1
vote
1 answer

EF Core how to add a filter to .ThenIncludes

I'm using EF Core 5.0.4 I have these three entities that have relations. public class Parent { [Key] public int ParentId { get; set; } [Key] public short ChildId { get; set; } public string ParentProp1 { get; set; } public…
haydnD
  • 2,225
  • 5
  • 27
  • 61
1
vote
0 answers

How to build a queryable to find all words of string array from database column

I have this code , Any body has a solution string[] splitSearch = request.Search.Split(' ');// for example: [best , selling , book , of , the , year] or [in , memory , of , love] var queryable = _context.books.AsQueryable(); queryable = queryable …
1
vote
0 answers

$Expand Failing on Webapi Queryable end point using Entity Framework

I am trying to do $expand on queryable end point and getting this error. Object of type 'System.Linq.EnumerableQuery`1[System.Web.Http.OData.Query.Expressions.SelectExpandBinder+SelectAllAndExpand`1[pc_process_api.Models.Task]]' cannot be converted…
VKR
  • 655
  • 1
  • 8
  • 14
1
vote
1 answer

No Exists method so I want to use AsQueryable for defensive programming

I am writing some code which queries the Visual Studio object model. I see that there is no Exists method on the Projects collection object but I do like defensive programming and not relying on try catch blocks. So I see there is AsQueryable() on…
S Meaden
  • 8,050
  • 3
  • 34
  • 65
1
vote
0 answers

C# MongoDB odd behaviour and exceptions with nested queries

I built tiny test project available at https://github.com/MyGitHubTests/MongoNestedTests/tree/master/MongoTest Here's my JSON document example github.com/MyGitHubTests/MongoNestedTests/blob/master/MongoTest/MongoTest/TestJSON/MongoTest2.json : { …
1
vote
2 answers

LINQ: How i can user where condition multi value by array string?

I want to use the linq where condition multi value by array string is split(',') I list data from data file in folder. (not in database) Code c# public List GettingFiles(string path) { //Read File in folder List allfile = new…
nettoon493
  • 17,733
  • 7
  • 30
  • 45
1
vote
1 answer

AsQueryable linq statement with selecting the ID field

Given a simple model: public class Model{ private string _id; [BsonId(IdGenerator = typeof(StringObjectIdGenerator))] [BsonRepresentation(BsonType.ObjectId)] public string Id { get { return _id; } set { _id = value;…
Colsa CSF
  • 33
  • 1
  • 6
1
vote
1 answer

OData WebAPI, in-memory queryable and case-sensitivity

I have a problem with OData WebAPI and querying a EnumerableQuery (a list on which I called .AsQueryable(). I have a entity set, a controller with a Get method which returns the IQueryable. When I query that entity set and use this…
1
vote
5 answers

Reflection to Filter List

I am new to Reflection so please excuse my noob question. How can I create a Method that takes two Parameters, a Generic List and a String and then finds all items in that List where any property value matches the string. So for example we have an…
w2olves
  • 2,229
  • 10
  • 33
  • 60
0
votes
1 answer

Error report of C # groupby using AsQueryable

var commodity = _appDbContext.ArchivesCCommodity.Where(lambda) .GroupJoin(_appDbContext.ArchivesCCommoditySpecification, a => a.Code, b => b.Commodity, (a, b) => new { a, b }) .SelectMany(a => a.b.DefaultIfEmpty(), (a, b) => new…
afr751116
  • 5
  • 2
0
votes
0 answers

AsQueryable - where will be the Logic when I execute it?

When I do var arr = new int[] { 100, 200, 300, 400 }; var q = arr.AsQueryable(); q is an IQueryable (concrete an EnumerableQuery). Now, when I call Queryable.Sum(q) where can I find the sum-Logic? When I look into the Sum-Method, I see…
BennoDual
  • 5,865
  • 15
  • 67
  • 153
0
votes
2 answers

C# ASP.NET Core Entity Framework Core asynchronous ToQueryable comparison

I am using EfRepository to access data and I have a DbSet. I'm trying to access data asynchronously and I need it is as Queryable and I'm currently using this: public virtual async Task> AllAsync() { var…