Skip to main content

All Questions

Tagged with
0 votes
0 answers
93 views

Why this C# code runs slow if the loop is more than 30 times? [closed]

int range = 20; var test = Enumerable.Range(0, range).Select(i => new Section { Id = i, Value = i }).ToList(); var result = RemoveEvenNum(test); foreach (var section in result) { Console....
Hui Jin's user avatar
  • 19
0 votes
1 answer
54 views

Pagination on the result from multiple collection .net

I am trying to add offset pagination( input is pagesize and limit) on combined result which is aggregating multiple collections. Earlier I had only limit on the reponse. Below is the code for the API ...
Divya Vyas's user avatar
1 vote
1 answer
49 views

How to delete the rows of datatable1 having different ID while compare with the datatable2

Given the first data table having master data and the second table having the needed data IDs, I need to delete the rows from the first table which are not present in the 2nd table. I am trying to use ...
Dev's user avatar
  • 1,681
0 votes
0 answers
28 views

Use some kind of helper function In EF Select query to make subquery [duplicate]

I have several tables that handles different kinds of translations for my entities and those tables to linked via relations to other entities. I use subquery to directly access translations tables ...
user3408420's user avatar
0 votes
0 answers
30 views

Search implemented using LinqKit predicateBuilder working fine in the local but not working in the dev build

I have implemented a search functionality using the LinqKit predicate builder. It is working fine in the local environment and when it is published to a folder the same functionality is not working. ...
sid's user avatar
  • 1
0 votes
1 answer
51 views

Why does adding .AsQueryable() and .AsNoTracking() seem to work for filtering related entities in Entity Framework Core? [closed]

I need to filter related entities while including them in the query. Each Order has a Customer, and multiple OrderItems, and each OrderItem has a Product. I want to include OrderItems that either ...
amiad dvir's user avatar
0 votes
0 answers
92 views

Dynamic LINQ sorting after grouping

We wrote a generic filterable repository in .NET 8 that should be able to accept a list of filters and a list of sorts, and apply them to any given entity. Due to some business logic, we have a Task ...
Predrag Despotovic's user avatar
2 votes
2 answers
80 views

How can I reuse the logic in a .Include.Where() call while working with Entity Framework Core in .NET?

I am writing a database query using LINQ in .NET and I want to be able to not duplicate the code I put in my Where method calls. I want to return Blogs that have fresh Comments, and want to filter ...
MonstraG's user avatar
  • 359
0 votes
1 answer
54 views

EF Core 8 : single value objects. Error on linq

In EF Core 8, I'm trying to do this query (Active is a simple value object of type bool): return await _dbSet .Where(e => e.Active.Value) .ToListAsync(); And I get: ...
marcosagni98's user avatar
0 votes
0 answers
56 views

Translate expression bodied member to SQL so it can be used in LINQ where clauses?

Is it possible to write an extension to EF Core that tells it how to translate expression bodied members (or methods) to SQL so a getter/method can be used in where-clauses? What I would like to ...
Tommy Jakobsen's user avatar
0 votes
2 answers
60 views

linq join two datatables

I am trying to join two datatables with linq The query is out_dt = (From row1 in dt1, row2 in dt2 where row1("id").ToString = row2("id").ToString Select row1).CopyToDatatable ...
user13831679's user avatar
-1 votes
1 answer
114 views

List used as a queue in .net and retain order [duplicate]

I want to use a List as a queue. This is because List is more flexible when getting/inserting data. My question is when I use Linq operations (DistinctBy, Take) as shown below, do I still get the ...
Patola's user avatar
  • 563
0 votes
1 answer
43 views

Unable To Change TextBox Value

I am passing value from one form to another and the value from second form is from DataGridView. I can see it passes data perfectly when debugging in the first form and did as follows: public Form1() {...
user8512043's user avatar
  • 1,111
1 vote
1 answer
121 views

How to eliminate nested joins in generated SQL query?

I created a LINQ query in a .NET Core Application to retrieve some data. When checking the generated SQL for the LINQ I noticed nested queries in it. I want to optimize my LINQ query by removing the ...
user23507681's user avatar
0 votes
2 answers
79 views

Linq how can do null check in where clause?

This is simple linq query datetime dob = "05152024"; var query = from row in maxLookupData.AsEnumerable() where row.Field<DateTime>("bar")) <= dob select row; In ...
Software Enginner's user avatar

15 30 50 per page
1
2 3 4 5
650