You can simply use groupby
in Linq query. It can reach same result like T-SQL's distinct
operate.
Group fields you want to distinct first, you can get the groups you create. Then you select the first of items in groups.
Finally, You get the distinct rows you filter.
Lambda expression :
var boo = ConstituentRecords
.GroupBy(o => new { o.ConstituentGroupNameId, o.UserId, o.CreatedTime } )
.Select(g=>g.First())
.ToList();
or
query expression :
var boo = (from v in ConstituentRecords
group v by new { v.ConstituentGroupNameId, v.UserId, v.CreatedTime } into g
select g.First()).ToList();