I'm trying to retrieve a Dictionary as a return value from a query, and I haven't had much luck with the following:
IQuery query = session.CreateQuery("SELECT Email, COUNT(Id) as IdCount FROM AccountDataModel WHERE Email = :Email")
.SetParameter(":Email", model.Email);
IList<T> list = query.List<T>();
IDictionary<string, object> data = list.ToDictionary<string, object>(x => x); //Error, no method argument matches.
The ToDictionary method asks for a type of Func. I found a definition for Func, here.
After seeing this, I tried the following:
list.ToDictionary<string, object>(y => y.As<string>().As<object>());
I receive an error in the process...
Is there a straight way to do this, or is it more of a hacky methodology which promotes it?