All Questions
Tagged with linq entity-framework
12,905
questions
1
vote
1
answer
52
views
LINQ group with list inside shows only the first row
I have a view in the v_PortalProprietario database that returns in each line the name of the owners that are repeated and the accounts (Acertos) that are unique. I would like to make a query in Linq ...
0
votes
2
answers
55
views
How to join tables and group the results using LINQ?
I have a table of Products and a table of Product_Images with a one to many relation (one product can have multiple images) and I am trying to retrieve all products with their related images. So far I ...
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 ...
0
votes
3
answers
79
views
Sequence contains no elements in LINQ
In the code shown here, I am getting an error in LINQ:
Sequence contains no elements
When the reason column contains data, it is throwing this exception. Please suggest how to handle this exception.
...
0
votes
3
answers
58
views
Entity Framework C# join with one column only from second table
I have a join in Entity Framework connecting the Order and the OrderItem tables. All orders will have multiple order items. I'm trying to return all the orders, but only the orderItemStatus column ...
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 ...
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. ...
1
vote
2
answers
120
views
Multiple tables query with repository pattern
I have an ASP.NET Web API project, and have implemented repository and unitOfWork patterns.
I currently have a big SQL query that I want to implement in code, it includes a lot of tables and joins.
My ...
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 ...
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 ...
1
vote
1
answer
56
views
Join tables based on StartsWith function
I have two tables to join. The joining condition is a column that should be like or starts with the other column, not exactly equal. How to do that in Linq? This is my function:
public async Task<...
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 ...
0
votes
1
answer
81
views
Trouble displaying a list of movies corresponding to each genre in ASP.NET Core MVC web application
I'm working on an ASP.NET Core MVC web application using C# and Entity Framework. I have a Movie class with a GenreId property, and a Genre class with an Id property. I'm trying to display a list of ...
0
votes
0
answers
64
views
EF Linq query on date
Here's a simplified version of what I'm doing:
DateTime mydate = DateTime.Now;
var myObject = db.Objects.First();
myObject.lastseen = mydate;
db.SaveChanges();
var myobjects = mydb.Objects.Where(a=&...
0
votes
2
answers
66
views
How do I do an inner GroupJoin on dotnet?
I'm using .NET 6 with Entity Framework. This is my situation:
I have a BenefitEntity (with Name and Description properties and a relationship with BenefitCategory) and this BenefitCategory which has ...