How to map ntext using NHibernate Mapping-By-Code function of NHibernate 3.2?

I need to map the ntext column of a table using mapping using a code function in NHibernate 3.2 so that it does not truncate to 4000 characters.

What can I change in the following example? "Notes" is a property that is of type ntext in the sql table:

Property (emp => emp.Notes);

Note. Please do not mix it with NHibernate or hbm free display.

+5
source share
3 answers

So, I solved the problem as follows:

Property (emp => emp.Notes, map => map.Column (col => col.SqlType ("NTEXT")));

, , , : NHibernate mapper sql.:)

, jbl.

+2

, , nvarchar (max):

Property(emp => emp.Notes, m => m.Type(NHibernateUtil.StringClob));

,

+1

Try:

Property(emp => emp.Notes, mapinfo => mapinfo.Lenth(someHighValue));

If the provided length is longer than what varchar can fit, NHibernate will switch to a different type of character.

0
source

All Articles