views:

211

answers:

1

I needed a way to trim strings within my persistent class because my legacy database is using char fields. I downloaded the nHhaddIns dll to use its TrimString class which is derived from IUserType.

Using their example I created a property in my mapping class as shown at the bottom.

uNHAddIns is added as a project within my solution. However, I received this error:"Could not determine type for: uNhAddIns.UserTypes.TrimString, uNhAddIns, for columns: NHibernate.Mapping.Column(HSTAT)"

I tried running the example that is in the uNhAddIns project and receive the same error. Any ideas?

 <property name="HSTAT" column="HSTAT" type="uNhAddIns.UserTypes.TrimString, uNhAddIns" />
A: 

Don't know if you've managed to fix this already, but does your own uNhAddIns.UserTypes.TrimString inherit from IUserType? My own pattern for user types in NHibernate involves the type implementation living in the DataModel, and the required IUserType interface living separately in my DataAccess layer. The IUserType implementation does the necessary marshalling between the database and my DataModel type implementation.

I just came across this same error when trying to use the DataModel class in my mapping file rather than the IUserType implementation.

alastairs