开发者

nhibernate get all values for a type

开发者 https://www.devze.com 2023-03-05 12:38 出处:网络
I am using NHibernate in my project and I need to get all of the values in a table for a specific type (of domain model) and the type is variable.

I am using NHibernate in my project and I need to get all of the values in a table for a specific type (of domain model) and the type is variable.

I can use the criteria to do criteria.List() but the problem is that the type is variable and passed to me at run time so I need to be able to specify a type that is n开发者_运维知识库ot constant and get all of the values in that table according to the NHibernate mappings.

Is this possible?


You could try one of the following:

session.CreateCriteria(type).List(results);

session.CreateQuery("from " + type.Name).List(results);
0

精彩评论

暂无评论...
验证码 换一张
取 消