Category "linq"

Linq most efficient top results

I'm wondered I have a table with IDs and a version and a remove field. I d like to return the the top 20 records grouped by ID and for ech ID take only the hig

How to Bulk Update records in Entity Framework?

I am trying to bulk update records using Entity Framework. I have tried Entity Framework.Extensions Update method. The Update method is able to bulk update for

Get ID of item selected in ComboBox

I have a ComboBox that gets filled with items from my database. I'm trying to get the ID of the item that is selected in the ComboBox, but nothing I've tried se

Groups the specified bookings based on their consecutive dates

var listForTestGroup = new List<Booking> { new Booking{Project="HR", Date= DateTime.Parse("01/02/2020") , Allocation= 10},

Check null value in a list using linq

I have a list List<OfferComparison> Comparison. I want to check if all the items have Value == null in an if condition. How can I do it with linq? publ

Sorting a 1-to-many relationship for a log table for the most recent item

So I have a table, Equipments, that contains assets. There is a table connected to this one in a 1-many relationship that logs each time it is inventoried, by w

How to Bind a group by data in view in mvc5? what are the best ways to do

I am using Entityframework context, i dont know how to bind to view. I am grouping items by gender public SQLChallengeEntities Sqlcontext = new SQLChallengeEn

Could not find an implementation of the query pattern for source type 'System.Data.Entity.DbSet'

I'm using Entity Framework for the first time, but it seems not working as expected. I have this code: using System; using System.Collections.Generic; using S

Get Dictionary value in IQueryable LINQ to Entities query

I have to support multiple languages in production application. There are lot of Entity Framework queries that gets data from database as deferred IQueryable l

Add Items To a existing List In a dictionary

I have a dictionary as below var dicAclWithCommonDsEffectivity = new Dictionary<string, List<int>>(); I have a list as below var dsList=new Lis

Can't use custom extension methods with IronPython

I have some extension methods I defined in my C# class, which I can import just fine into an IronPython script. However, when I attempt to call one of these met

Splice IEnumerable with Linq

Is there an in-built way to splice an IEnumerable in Linq-To-Objects? Something like: List<string> options = new List<string>(); // Array of 20 st

How to implement left join in JOIN Extension method

I am trying to implement an outer join on this kind of query for the p.Person table. How would I do this? This example is taken from http://ashishware.com/DSLi

IEnumerable vs List - What to Use? How do they work?

I have some doubts over how Enumerators work, and LINQ. Consider these two simple selects: List<Animal> sel = (from animal in Animals

Suggestions for designing complex LINQ code

What are your suggestions for designing linq code in project? Especially, I`m interesting in code design of big and complex linq queries? For example, you know,

Union two list by property

I would like to merge two list without duplicates. It should distinct only by one property. I have a class: public class Test { public int Id { get; set;

How can I project into the same DTO type twice?

The goal here is to update an IQueryable that projects into a dto so it only includes a subset of the properties that it originally included. The "subset" is be

How can I project into the same DTO type twice?

The goal here is to update an IQueryable that projects into a dto so it only includes a subset of the properties that it originally included. The "subset" is be