Is there anyway around this error? I'd like to reuse the same lamba expression in other queries instead of having duplication. Can LinqKit or other linq expression do this?...Error...LINQ to Entities does not recognize the method 'Boolean GetEvent(Tournam...
EF Core has support for ...explicit loading.... The context has two overloads, one for references and one for collections....Having two methods is not useful, and gets messy. I want a single method for accepting both as a params array....So instead of thi...
I have 2 lambda expressions that are virtually the same. One returns ...Expression<Func<Person, bool>>... and the other returns ...Expression<Func<Admission, bool>>.......There is a direct relationship between these 2 entities. A ...Person... can have man...
I'm trying to write a repository method for Entity Framework Core 2.0 that can handle returning child collections of properties using .ThenInclude, but I'm having trouble with the second expression. Here is a working method for .Include, which will return...
I have a repository that gets a lambda expression for 'include'. ...public TEntity FirstOrDefault(Expression<Func<TEntity, bool>> predicate, params Expression<Func<TEntity, object>>[] includePaths)
{
return Context.Set<TEntity>().Includes(incl...
I'm trying to make sorting easier for an C# Application and C# Web API. I'm using Entity Framework Core for my persistence and testing....In my application or Web API I determine the Order, Descending or Ascending, Property Name....I pass this knowledge ...
Is it possible to store a lambda expression as a variable and use it in multiple places.
My db objects have an ...Id... as int and a ...UId... as an uniqueidentifier and I have to write very similar expressions when selecting based on ...Id... or ...UId..
I would like to be able to reuse ...fragments... of my select lambda expressions in my Entity Framework Core 2.0 queries. ...For example:...var result = await ctx.Customers
.Select(cust => new CustomerDto {
CustomerId = cust.Id,
CustomerName = ...
I am trying to create expression dynmically but i could not figure it out... Also dont want to use like this.....if (item.id == 1) filter.AddExpression(c => filterValues.Contains(c.a1));
if (item.id == 2) filter.AddExpression(c => filterValues.Contains(c....
I am trying to implement a LEFT OUTER JOIN in Linq against an Entity Framework Core 2.0 DbContext. It's important that the query is translated to SQL, rather than evaluated locally. I've reviewed several StackOverflow solutions including ...this one... ...
I use ....Select(i=> new T{...})... after every db hit manually to convert my entity objects into DTO object. Here are some sample entities and DTOS...User Entity;...public partial class User
{
public int Id { get; set; }
public string Username { ...
How to create the equivalent code in Linq or lambda?...I'm using Entity Framework Core on Asp.net Core 2....SELECT
(SELECT
STUFF((SELECT DISTINCT ', ' + Roles.Name
FROM AspNetUsers Users
INNER JOIN AspNetUser...
I want to include the ...isDeleted... values in the database to my index when the user is an admin. I used the global query filter to filter the data. ...This is the code I have:...var param = Expression.Parameter(entity.ClrType);
var propertyMethodInfo ...
How can I combine ...BinaryExpression... and ...Expression<Func<dynamic / T, bool>>...?...For example:...void AddGlobalFilter<T>(Expression<Func<T, bool>> expr)
{
var parameter = Expression.Parameter(type, "t");
var member = Expression.Property(fi...
i am working with the entity framework core HasQueryFilter method while having a dynamic variable within this filter expression. Because of this dynamic parameter (lets name it "MinPriority") i cannot directly pass a lambda expression like...HasQueryFilte...
How to create "inline if statement" with expressions in dynamic select for null checking ...I was wrote a dynamic linq select expression for a nested property of a object, but it throw an exception when it is null. so i want to check whether that property...
I have a query Like below in .net Core 2.2 with EF....var data = context.Customer
.GroupJoin(context.Orders, c=> c.Id, o => o.CustoerId, (c, o) => new
{
customer = c,
...
I have an issue now that a table has had an id removed....First I had this query below where entity (table) 'RecordsProduct' has a 'DefendnatId' that was mapped to a Defendant table. It was fine! ... records = records
.Include(r...
I am trying to implement ...OrderBy... and ...ThenBy... in a different way to hide lambda expression from ...OrderBy... and ...ThenBy... extension methods. These extension methods accept classes which implement ...IOrderSpecification...: ...public class P...
I currently use Entity Framework Core, and it works really well. However, one things I am trying to optimise in my application is returning computed data from the database at the time of querying. I am using code first, where each model directly maps to a...