Distinct() extension method problem with Object Initialisers

Description

This code will fail:

var data = (from v in this.GetSession().Query<WorkCellLoadGraphData>()
where v.WorkCellId == "13"
select
new WorkCellLoadGraphData
{
RowId = v.RowId,
WorkCellId = v.WorkCellId,
WorkCellName = v.WorkCellName,
WorkCellGroupId = v.WorkCellGroupId,
WorkCellGroupName = v.WorkCellGroupName
});
return data.Distinct();

However, running this code:

var data = (from v in this.GetSession().Query<WorkCellLoadGraphData>()
where v.WorkCellId == "13"
select v
);
return data.Distinct();

will "work".

The error I get is: "Expression type 10005 is not supported by this SelectClauseVisitor."

Environment

None

Activity

Show:

Alex Zaytsev 
May 7, 2014 at 9:30 AM

Finally commited to master @ 12e861593bd0b24cf52838ce45179b2753e4bfac

Krzysztof Koźmic 
March 30, 2012 at 5:53 AM

@Oskar Berggren I'm projecting to a DTO and it also fails

Oskar Berggren 
January 5, 2012 at 11:04 PM

Why are you instantiating the same type as you already have in the query?

Krzysztof Koźmic 
November 15, 2011 at 7:10 AM

I wouldn't say it's a minor issue. From my perspective it's pretty critical really. Any plans to fix it? Two versions have been released since it's been reported...

Radu Ban 
May 28, 2011 at 5:01 PM

same as and

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created January 5, 2011 at 2:25 AM
Updated September 21, 2014 at 12:40 PM
Resolved May 7, 2014 at 9:30 AM
Who's Looking?