Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get NHibernate.Type.IType from a Type?

Tags:

c#

hql

nhibernate

I try to do the following:

hibQuery.SetParameter("MyParameter", valueObject, valueType);

The only problem is that this method expects NHibernate.Type.IType in the third parameter, but valueType is of type Type. How could I convert this to IType?

Thx for any tipps sl3dg3

like image 878
sl3dg3 Avatar asked Mar 03 '11 15:03

sl3dg3


2 Answers

Try the built-in NHibernateUtil.GetSerializable() method. It takes a CLR System.Type and returns the corresponding IType. More documentation: http://elliottjorgensen.com/nhibernate-api-ref/NHibernate/NHibernateUtil.html#M:NHibernate.NHibernateUtil.GetSerializable%28System.Type%29

like image 84
KeithS Avatar answered Sep 19 '22 13:09

KeithS


Check out the NHibernate.Type.TypeFactory.GetSerializableType() method.

like image 22
Jarrett Meyer Avatar answered Sep 20 '22 13:09

Jarrett Meyer