I'm wanting to remove duplicate records from a table that has over 2 million rows. I have an IEntityQuery that does the grouping and counting and returning where count() > 1. The problem is this query also could return over a million rows. I would like to do a TOP 100 query using DevForce, but I haven't found a way to do this. I realize that I can use .Take(100) after Execute(), but this requires returning all of the rows and then taking 100. I want the query to only return 100 rows from the database. This seems like a fairly common need, but so far I have not been able to find any examples on the web or IdeaBlade's site on how to accomplish this.
Thanks!!!
var query = from log in Manager.Logs
select logs;
query
.Execute()
.ToList()
.Take(100); --Bad for this query--
If you do the Take() before the Execute the generated SQL will contain the Top operator. So something like this:
var query = from log in Manager.Logs
select log;
query
.Take(100)
.ToList();
If your actual query type is more complex due to grouping you may need to do a cast to use the Take method.