Common tasks in LINQ and entity framework
- LINQ
- .NET
- entity-framework
- c#
This is a personal reference for me but if it helps someone, all the better!
Group items by multiple keys
e.g. Group activities by the year and month of their start date (“StartDate” is of type DateTime
).
Case insensitive string contains search
Out of the box, the entity framework provider will do a case insensitive search when just using Contains
. It will be converted to a SQL “like” where clause (where value like %searchValue%
).
The above would generate the following SQL: