Beginner |
|
Joined: Sat Dec 10, 2005 6:22 pm Posts: 28 Location: Chicago, IL
|
You can use the NHibernate.Mapping.Attributes to tag your classes and build your mapping files. You can then use attribute reflection to get at these properties. Check out the Nhibernate.Mapping.Attributes project under NHibernateContrib.
The only other way to do it within NHibernate would be to somehow get a handle to the SessionFactoryImpl class so you can get the mapped SqlType of the property. I believe it is only the SqlType that contains the length parameter.
You can call GetClassMetaData on the ISessionFactory to retrieve the metadata but I think this is useless unless you can somehow get a handle to the mapped SqlType. There is a function on the IType interface to get the SqlType but it requires an instance of the IMapping interface. The only object I know of implementing the IMapping interface is the SessionFactoryImpl. I do not think there is a clean way to get this but you can probably force a cast somewhere if your desperate.
|
|