Category "linq"

Is there a more Functional way to aggregate a collection into set of Mongo Filters conjugated by OR?

We have a microservice which enables consumers (indirectly) to query a database, where we have our own logic to limit what consumers can do with the queries. Wh

Using LINQ to select the last record in .NET Framework

I need to query for the last record in a SQL database, utilizing LINQ. The way I am doing it now takes two steps. First, I get the ID value with a OrderByDesce

LINQ query with multiple LEFT JOIN

I have 1 main table and 3 tables for ordering the fields in the main table. I return all these tables as lists. The main table structure is like this: Color Ma

'Nullable object must have a value.' for List in LINQ c#

In database I have next model tblWorkItem with next field: public List<xWorkItemItemFailReason> WorkItemItemFailReasons { get; set; } When I am trying

Cast IQueryable<DomainModel> to IQueryable<EntityModel> for EntityFramework

I'm trying to convert an IQueryable to IQueryable to allow me to take advantage of the dynamic filtering offered by Linq in the EntityFramework context. I'm try

ef core angular - is there a way to get and display data from database in input box depends on another input box

First Input Box will ask the user to enter employee number Second Input Box (readOnly) - employee name will be display here automatic base on employee number pr

Dynamic where condition LINQ

I have a problem with my code. I don't know how I can insert in my selection all equals conditions of: codicielementipartizione.sezione == el[i].ToString() d

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