how to remove repeated record's from results linq to sql

Posted by Sadegh on Stack Overflow See other posts from Stack Overflow or by Sadegh
Published on 2010-05-25T19:16:58Z Indexed on 2010/05/25 19:21 UTC
Read the original article Hit count: 251

Filed under:
|
|

hi, i want to remove repeated record's from results but distinct don't do this for me! why???

var results = (from words in _Xplorium.Words
                           join wordFiles in _Xplorium.WordFiles on words.WordId equals wordFiles.WordId
                           join files in _Xplorium.Files on wordFiles.FileId equals files.FileId
                           join urls in _Xplorium.Urls on files.UrlId equals urls.UrlId
                           where files.Title.Contains(query) || files.Description.Contains(query)
                           orderby wordFiles.Count descending                               
                           select new SearchResultItem()
                           {
                               Title = files.Title,
                               Url = urls.Address,
                               Count = wordFiles.Count,
                               CrawledOn = files.CrawledOn,
                               Description = files.Description,
                               Lenght = files.Lenght,
                               UniqueKey = words.WordId + "-" + files.FileId + "-" + urls.UrlId
                           }).Distinct();

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about join