Questions tagged [linq]
Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages. Please consider using more detailed tags when appropriate, for example [linq-to-sql], [linq-to-entities] / [entity-framework], or [plinq]
86,700
questions
0
votes
1
answer
55
views
System.Xml.XmlException: 'The ' ' character, hexadecimal value 0x20, cannot be included in a name.'
Wrote the code converter csv file to xml file and when i started it i have an error:
internal class Program
{
private static void Main(string[] args)
{
var csvFile = @"sbor.csv&...
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. ...
0
votes
0
answers
55
views
Is there a way to convert a LINQ expression to another LINQ expression?
My repository class has a few methods for operations with the database. I recently developed the FindAsync() method, which allows you to grab only a few rows from the database based on an expression.
...
1
vote
1
answer
89
views
EF Core : retrieve products with all supplier prices for price comparison and identify cheapest supplier
I'm working on an ASP.NET Core application using ABP framework and EF Core. I need to retrieve information about products and their suppliers for comparison purposes.
Specifically, I want to achieve ...
0
votes
1
answer
55
views
How to access a XML Parent Attribute with LINQ in C#
I cant seem to get the Linq syntax correct - or I dont know how to reference XML objects.
I have XML like
<?xml version="1.0" encoding="UTF-8"?>
<Targets>
<...
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
0
answers
21
views
Coerce generic argument of expression
I have a situation where I need to logically-combine two expressions:
Expression<Func<T1, bool>> expr1; Expression<Func<T2, bool>> expr2;
In some cases, T1 and T2 are the same ...
0
votes
1
answer
30
views
LINQ returning null for some xml read
My xml read with linq used to work great, but I recently changed my xml (the team wanted flatter xml), and the format is like this now:
<?xml version="1.0" encoding="UTF-8"?>
...
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
1
answer
82
views
Using Linq to select multiple values with reflection VB.NET
I'm experimenting with some LINQ in which I'd like my filters to be dynamically loaded at run time and for the result set to be returned as a 2d list of:
Type
Link
Google
[email protected]
...
-1
votes
0
answers
74
views
Join in-memory list and DB table in .net 8
I have a code that is working in .Net 3.1 and we have upgraded to .Net 8 and as part of that I have converted Nuget package Microsoft.EntityFramework.MemoryJoin to 0.8.0 and I observed the in-memory ...
-1
votes
0
answers
55
views
Link collection string not matching a string
I have a collection from a api call where i have field called links, as below image
Now I need to loop through these 100 records like this and match with the company number that i have.
To achieve ...
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<...
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 ...