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)…

How to convert SQL query to Linq in Entity Framework 6?

How can I convert this SQL query to a linq expression? Select distinct Clients.Id From Clients Join Orders On Clients.Id = Orders.ClientsId and Orders.Date < DATEADD(DD, -Clients.Term, CAST(…

How to map from query string to SQL query? [closed]

So I have as search endpoint [HttpGet(“search”)] public async Task Search([FromQuery] string query) that returns a list of users from the cosmosDb based on email, name …

Delete all related rows to user using EF .NET CORE

I have little problem with data delete. Let s assume that I have to delete user and all related rows to this user. I wrote some code in c#, but it takes ages to complete. Here is my some of my code. …

How many SQL Queries will be executed in the database through this EF

I have the following and want to know how many queries will be executed in the DB through this EF? private static dbContext dbc = new ProfileDBC(); private static IQueryable GetProfile(…

Postgres – Geospatial Search in LINQ or SQL with PostGis

I am using PostGis to search for all points within a given range, relative to a given origin. I am looking at all the documentation provided by PostGis but can’t seem to figure out how would I come up …

Find turning points in rows with SQL or LINQ

Lest say I have the following data: Date Value 04.04.2019 | -1,7 05.04.2019 | -3,3 06.04.2019 | -4,4 07.04.2019 | -6,4 08.04.2019 | 5 11.04.2019 …

Select items with the same foreign key

I have a question regarding Linq in C#. Let’s say that I have 3 tables “Company”, “Employee” and “Job”. Company ——– Id – int (PK) Name – string Employee ——– Id – int (PK) CompanyId – int …

How to replace columns in a Queryable in a generic fashion without executing the Queryable

As an example, I have a Product entity, a ProductViewModel and a Label entity. Two of my product properties correspond to a label code rather than an actual value. So for example a Product’s Name is “…

How can I convert this sql query that reorders items in a database to linq?

I currently have a table where an item has a new order based on a column it’s being sorted by. The goal of the sql statement is to reorder the table based on that sort column. The SQL Command …