NHibernate Transformers.AliasToEntityMap 返回Hashtable

string query = "select a.CustomerName as CustomerName, b.ProductName as ProductName from Customer as a join a.Product as b" 

IQuery query = applicationSession.CreateQuery(query);
var listResult = query.SetResultTransformer(NHibernate.Transform.Transformers.AliasToEntityMap).List<Hashtable>();


string customerName = (string)listResult[0]["CustomerName"];
string productName  = (string)listResult[0]["ProductName"];

  http://stackoverflow.com/questions/4384056/nhibernate-how-to-retrieve-the-data-from-iquery-list-using-field-name

 

 

 

posted @ 2014-03-10 00:24  庚武  Views(699)  Comments(0Edit  收藏  举报