NHibernate返回Dictionary <int,string>

use*_*482 2 c# nhibernate dictionary

是否可以<int, string>从nhibernate查询中返回Dictionary ,例如:

CreateQuery("select CustomerId, FullName from Customer")  
Run Code Online (Sandbox Code Playgroud)

我已经尝试使用.net ToDictionary方法从这个论坛中的一些例子,但我无法让它们工作.

Baz*_*nga 5

您需要在列表中进行以下操作或枚举,您应该获得dictonary

.ToDictionary(x => x.CustomerId, x => x.FullName);
Run Code Online (Sandbox Code Playgroud)