zzz projects Entity Framework 6 EF 6
Home EF Core 5 Articles Knowledge Base Online Examples
  • Home
  • EF Core 5
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework 6 - Knowledge Base (KB)

63 results for: in tag: lambda

LINQ to entities - Building where clauses to test collections within a many to many relationship

So, I am using the Linq entity framework. I have 2 entities: ...Content... and ...Tag.... They are in a many-to-many relationship with one another. ...Content... can have many ...Tags... and ...Tag... can have many ...Contents.... So I am trying to write ...
c# entity-framework lambda linq many-to-many
asked by Phobis

C# LINQ Where Predicate Type Arguments

I have an XElement with values for mock data. ...I have an expression to query the xml:...Expression<Func<XElement, bool>> simpleXmlFunction = b => int.Parse(b.Element("FooId").Value) == 12; ...used in:...var simpleXml = xml.Elements("Foo").Where(si...
c# entity-framework expression-trees lambda
asked by blu

C# Expression Tree Parameter for Parent Navigation Property

How can I create a ParameterExpression for the parent side of a 1 to * Navigation Property?...The following works for the child entity:...var parameter = Expression.Parameter( typeof(T), // where T is the entity type GetParameterName()); // helper...
c# entity-framework expression-trees lambda
asked by blu

How to merge two C# Lambda Expressions without an invoke?

I'd like to merge the following Expressions:...// example class class Order { List<OrderLine> Lines } class OrderLine { } Expression<Func<Order, List<OrderLine>>> selectOrderLines = o => o.Lines; Expression<Func<List<OrderLine>, Boolean>> vali...
c# entity-framework lambda linq-to-entities
asked by Davy Landman

Entity Framework - Cannot convert lambda expression to type 'string' because it is not a delegate type

I am using Entity Framework in my C# based code. I am running into an unexpected weirdness and am looking for suggestions....Case 1, 2, 3, 4... Projects:... RivWorks.dll... RivWorks.Service.dll... RivWorks.Alpha.dll ...Samples (all of these work):...Riv...
.net c# entity-framework lambda
asked by Keith Barrows

Working with nullable types in Expression Trees

I have an extension method to dynamically filter Linq to Entities results using string values. It works fine until I use it to filter nullable columns. Here's my code:...public static IOrderedQueryable<T> OrderingHelperWhere<T>(this IQueryable<T> source, ...
c# entity-framework expression-trees lambda linq
asked by dstr

Like operator in Expression Tree

I have a Linq extension method to dynamically filter Linq queries using string values. For example: ...query.WhereHelper("columName", ">", 1).... I could use many different filter operators like GreaterThan or NotEqual etc. but not "Like". There is no Exp...
.net entity-framework expression-trees lambda linq
asked by dstr

Entityframework Join using join method and lambdas

It seems there are different ways to do joins using linq. One is more straightforward and involves just joining tables like this:...var found = from c in s.categories join cm in s.categorymaps on c.CategoryId equals cm.ChildCategoryId ...
entity-framework join lambda
asked by Mason

Lambda expression to SQL UPDATE statement using C#

Is library or code available to create SQL Update statements from lambda expressions? We would like to use strongly-typed lambda expressions to do updates instead of calling the object before hand, or using strings. I'm thinking of something like this..
c# entity-framework lambda
asked by Sterling Nichols

Checking for null value in c# var with LINQ & Entity framework

I'm quite new to LINQ & Entity framework as well as the var keyword in c# so please pardon me if this sounds like a 'newbie' question. ...I have problems checking for null values after doing something like this: ...var entry = myDB.Entries.Where(e => e.Em...
c# entity-framework lambda linq var
asked by yulun

Multi table join using Entity framework 4.1, should I use lambda or LINQ?

I'm new to the Entity Framework and I'm trying to convert a multi table join to use the Entity framework. The original SQL looked something like this...JOIN tab_NewsCommunities S1 ON S1.News_ID = tab_News.NewsID inner join tab_communities com on S1.Commu...
asp.net-mvc entity-framework lambda linq sql
asked by NullReference

left join using lambda expression

I have tableA and tableB.... I would like to perform left join using lambda expression. This is the equal sql statement:...SELECT * FROM tableA A LEFT JOIN tableB B ON A.userId=B.userId ...How can I do that using lambda expression?
.net c# entity-framework lambda
asked by Naor

C# lambda IN clause error

I’m having issues creating an IN clause using C# and lambdas....I have the following method ...GetUserList(string filtersByRoles)...The variable ...string filtersByRoles... can hold a comma-delimited value such as: “1,2” or “1,2,3” or “1,3,4â€...
c# entity-framework lambda linq
asked by Vlince

Group by with multiple columns using lambda

How can I group by with multiple columns using lambda?...I saw examples of how to do it using linq to entities, but I am looking for lambda form.
.net c# entity-framework lambda
asked by Naor

Max return value if empty query

I have this query:...int maxShoeSize = Workers .Where(x => x.CompanyId == 8) .Max(x => x.ShoeSize); ...What will be in ...maxShoeSize... if company 8 has no workers at all?...UPDATE:... How can I change the query in order to get 0 and not an excep...
.net c# entity-framework lambda linq
asked by Naor

How to convert an expression tree to a partial SQL query?

When EF or LINQ to SQL runs a query, it:...Builds an expression tree from the code,...Converts the expression tree into an SQL query,...Executes the query, gets the raw results from the database and converts them to the result to be used by the applicatio...
.net c# entity-framework lambda linq
asked by Arseni Mourzenko

Using Enums in Entity Framework Where Clause

So here is what I have for my enum. Really basic. The enum does NOT have a corresponding database table. Rather, whenever a class has a MyEnum property, the database has an int column. That all works fine....public enum MyEnum : int { Zero = 0, On...
entity-framework enums lambda linq
asked by Alec

Entity Framework - Where Clause

Let's say i have a table named User. When I use the Entity Framework to get the records i do like this:...var db = new Context(); var users = db.Users; ...It return all the users in my table. OK. If i do this:...var fooUsers = db.Users.Where(u => u.Name =...
asp.net asp.net-mvc-3 entity-framework lambda
asked by Rodrigo Manguinho

linq to entities, a where in where clause? (inner where)

I have a table with a one to many mapping to a table that has a many to many mapping to another table. I'd like to do the following:...var results = context.main_link_table .Where(l => l.some_table.RandomProperty == "myValue" && ...
c# entity-framework lambda linq linq-to-entities
asked by L2Eer

Linq. How to query list within list?

I have Store List (storeList) object. (Consists of list of Stores) Each Store has list of Addresses. Each address have AddressType property that can be PHYSICAL, ALTERNATIVE or MAILING....I am trying to return PHYSICAL Address object so I can modify its p...
entity-framework lambda linq
asked by bobetko

Page 1 of 4
  • 1
  • 2
  • 3
  • 4
  • »

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now