All Questions
Tagged with linq expression
716
questions
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
85
views
Generic expression to find partial string matches against dynamic list of fields in LINQ query
As I understand it, in particular with SQL Server:
LINQ queries convert the query code into T-SQL to execute against the SQL Server.
LINQ code logic doesn't always seamlessly convert to T-SQL, which ...
0
votes
1
answer
47
views
Dynamically select properties in runtime using Expression
I need to call LINQ selector with dynamic property names.
But LINQ selector can not return data that exists in property names.
The following is simulated sample code from my problems:
public class ...
2
votes
1
answer
60
views
How add MemberInitExpression into Bindings other Lambda MemberInitExpression
I have the following classes:
class Source {
public int Id { get; set; }
public string Name { get; set; }
public SourceItem Item { get; set; }
}
class SourceItem {
public Guid Id { ...
2
votes
1
answer
158
views
EF Core 7 - Include only items which are not deleted
In EF Core 7, I am able to filter included collections like
var users = _context.Users.Include(x => x.Roles.Where(y => y.IsDeleted == false)).ToList();
I would like to make an extension, which ...
0
votes
1
answer
227
views
System.Linq.Dynamic.Core: No applicable method 'ArrayLength' exists in type
When parsing the expression I get the error “No applicable method 'ArrayLength' exists in type 'Product'”.
Here's the expression itself:
var experession = "p => (p.MarketingProduct!= null) ...
0
votes
0
answers
459
views
EF Core 6, dynamically create LINQ expression for choosing columns in SELECT statement
In my c# EF Core 6 application I am looking for a solution to dynamically choose the fetched columns in the SELECT statement. I found an interesting approach here enter link description here that ...
0
votes
1
answer
22
views
Format SSIS Expressions for Easy Viewing [closed]
Is there a tool that is able to format or beautify SSIS expressions for ease of viewing?
Below is a sample expression. With all the brackets and LINQ if-else via ? and : makes analysis painful.
(...
1
vote
0
answers
28
views
LinQ expression translation to EF Core (SQL Server underhood) doesn't work as expected
I am currently working on the endpoint that returns data about entity.
I'm using expression to project db entity to dto so it will be done on the DB side.
_repository.GetAllAsync returns IQueryable
...
0
votes
1
answer
79
views
How to use indexOf() with linq query to get case insensitive data?
I am working on .net project with C# where i am using report to show students data.
I am providing searching on all fields and using dynamic field in where clause at run time.
I am using Student,Class,...
0
votes
1
answer
74
views
Cannot implicitly convert type in Linq query
I have below simple query,
Expression<Func<Info, bool>> Check = x=> true;
var result = from ab in context.Infos where Check select ab;
But I get this error
Cannot implicitly convert ...
0
votes
1
answer
156
views
How to convert type Expression to work on different type in C#
How to convert Expression<Func<A, bool>> to Expression<Func<B, bool>> in C#?
The A and B can be really different classes (e.g. no common parent).
I would want to do something ...
0
votes
0
answers
66
views
Using C# Expressions to build Array.All for Entity Framework
I'm building a SQL "WHERE" clause dynamically using the System.Linq.Expressions.Expression class.
There are two tables
Report and Document with relation one to many
public class Report
{
...
2
votes
1
answer
58
views
What's the differerence between PropertyInfo(s) retrieved from different scenarios
I have the following types:
public abstract class Entity<TId>
{
public TId Id { get; set; }
}
public class Country : Entity<int>
{}
public class Language: Entity<int>
{}
And I ...
0
votes
1
answer
185
views
Create EF query extension with an Expression
I want to write an Extension method of IQueryable to filter out some entities. This Method should have a parameter of type Expression<Func<T, int>> which is used to filter the entities.
...