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

 

 

 

你可能感兴趣的:(Hibernate)