views:

33

answers:

1

I am getting the above mentioned error with this expression:

var aggregate = from t in entities.TraceLines
    join m in entities.MethodNames.Where("it.Name LIKE @searchTerm", new ObjectParameter("searchTerm", searchTerm)) on t.MethodHash equals m.MethodHash
    where (t.CallTypeId & (int)types) == t.CallTypeId && t.UserSessionProcessId == m_SessionId
    group t by m.Name into d                                                   
    select new
    {
        d.Key,                                     
        d.Sum(x => x.InclusiveDurationMilliseconds) // <- squigglies on this line
    };

Any idea what is causing this error?

+3  A: 

Do something like:

select new
{
    d.Key,
    Sum = d.Sum(x => x.InclusiveDurationMilliseconds)
};

It can project a property name from another property, but not from a method....

Matthew Abbott
Came up with it just as you posted .. one of those late day need coffee mind slips. Thanks. Easy points for you :)
esac
Lol, don't forget to mark it as such then ;)
Matthew Abbott