开发者

nhibernate get all values for a type

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜