I have a column(named MetaData) of type ‘xml’ in my sql server 2008 database.
My mapping is as follow:
Table("AuditLogs");
Id(x => x.Id, "AuditLogRecId").GeneratedBy.Identity();
Map(x => x.MetaData)
When i try to insert a bulk of data, sometimes(when inserting big number of records), im getting the error : xml parsing line 1 character 4000 unexpected end of input.
I now changed the mapping of MetaData column as follow:
Map(x => x.MetaData).Length(1000000000);
Now i dont get any errors, but im not sure if this is the right way to solve this problem.
I would like to get some good advice about this.
Thanks in advance.
I would actually change it as follows:
The reason being that 2gb is the maximum length for an xml column type. I believe NHibernate defaults to 4000 bytes if you don’t specify.