I have a products table which contains thousands of products. I want to update only two columns (price, isAvailable) of this table. So is there is a way to select only those two columns from this table? This is the code that I am using. But I don’t want to select all columns. I have tried this But this is
Tag: linq
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 can I group a joined query with linq
I’m trying to produce a data set for a graph that would get me the same result as the following SQL query: But if I try to translate it into a linq query, I can’t get the same result, I either don’t have access to one or the other side of the junction, or I get a yearly total of
LINQ for getting the 5 latest records for each distinct name
I have been trying to get the 5 most recent records from a database with distinct names from the “Name” Column. Meaning I want the 5 latest records for each of the unique names in the table. Here is a sample table: I would expect the latest 5 Bob records (out of the 6 ), the 3 Chris records, and
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(…
How to use Group By with Task<IEnumerable> in LINQ
I am new to the entity framework and LINQ. Trying to learn it by example. I have an Entity called “Participant” as below: I am trying to use Group by and return the result as Task<IEnumerable<Participant>>. The Sql Query that I found the is : SELECT Count(Id) as #, Zip FROM [database].[dbo].[Participants] GROUP BY Zip Order By Zip The Code
Entity Framework I could not create the linq query
This is my scenario for tables Users can transfer money to each others. There are two options when the transferring. One is the direct to users budget, other one is project budget for the user to spend. a user can have multiple bank accounts. So, I would like to see list for transfer table according to recipter account Id. This
Converting complex SQL with FULL JOIN to Linq
I am trying to convert a SQL statement to Linq/Entity Framework, and am having a difficult time. Below is the SQL. The FULL JOIN and the GROUP BY seem to be what I’m struggling most with. I’ve reviewed this SO answer and I understand how to execute a FULL JOIN on its own, but can’t figure out how to integrate
SQL Query to LINQ (use join with two keys)
I have got SQL Query and trying to use LINQ because if EF. Can someone have a look at it tell me where is my mistake, please? SQL Query is working but LINQ returns no data. Basically there is two table A and Table B. I want to do join AB which is (Bring me Data exist in Table A
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 …