Skip to content
Advertisement

Tag: linq

Linq Find the most recurring record

I have a rent a car project. This is the table where I keep the rented vehicles I want to find the most rented vehicle in this table. How can I do this? So I want to find the most mentioned car Id in the table [I have to do it with context architecture. How can I do this with

CosmosDB count using OrderBy multiple conditions

I am using Azure CosmosDB, the model contains Id, and creationTime properties. What I am trying to do is count entries within time interval. I looked how to achieve it using LINQ but could not find a solution. What I used than is SQL. This is what I tried: Bare in mind the values i showed are for display purposes.

In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table

In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table. For example I have two table namely Users & CashBox. Users Table Field Value UserId int UserName string CashBox Table Field Value CashBoxId int ActivatedBy int DeactivatedBy int In this case, activatedby & deactivatedby has to

How do I convert this SQL into LINQ?

How Do I convert this sql query: select * from Trades where tradestatus = 1 and tradetype = 1 and maturitydate < GETDATE() and referenceId not in (select referenceid from Trades where tradetype = 2)…

Join multiple columns from the same table using Linq

I would like to convert following sql query into Linq to SQL going through this I have so far tried following which didn’t work out Edit: following query is being generated against Svyatoslav Danyliv answer which is returning 7 rows instead of 6 Answer Join which contains not just AND expressions is possible via from x in entities.Where(x => ..).

Advertisement