views:

315

answers:

2

typically definition of property/column looks like this:

<property name="DocumentSummary" column="DocumentSummary" length="100" type="String">
   <column name="DocumentSummary" />
</property>

I was assuming that NHibernate will validate data using length attribute before inserting/updating a row. Unfortunately it seems to be invalid assumption. So question is if NHibernate is using length attribute for anything? Does it make sense to set it for each property?

+1  A: 

It using it to create database definition sql. Look at SchemaExport class.

Alex Reitbort
+1  A: 

Also you might be able to programmically pull the lengths from the mappings, see this question. Note that that is for Java Hibernate, but I believe you might be able to translate that to NHibernate.

James McMahon