Skip to content
Advertisement

Tag: c#

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

How can I best implement async into my WPF application?

I’m working on a WPF application that runs SQL queries and returns a data grid of the results when pressed. Currently, the structure of my methods as I try to figure out async is as follows: Depending on the query ran, my application can get for anywhere between 30 seconds to 20 minutes. I have a progressbar on my application

Trying to work out why my query is sluggish

So I have this query in C#, it takes about 3.6 seconds to complete. Here is both table designs Product review table: Review Table: I did have my where clause like so, but made no difference: I’m not sure why it’s slow, does anyone have advice to speed it up? Thanks More Info: Both tables have 6069 rows I have

One large DB request plus many Casts vs. many single DB requests – which is faster for a lot of Data [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question let’s say you have 5 concrete classes implementing the interface IResult. And you want to work with many diffrent concrete objects

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

How to Select Records from large table batch wise in SQL

I have a table that contains billions of records. I want to select records in a batch using the c# while loop. I used Offset and Fetch Next, but it is taking too long to get results. If the table contains below 100k records, it works fine. What is the best way to batch select records? Sample Code Answer If

Advertisement