I am using NHibernate mapping by code and sql server 2012. I am also using the Sql2008ClientDriver as the driver in the session factory. I have been trying to figure out how to map the exact sql type and length to the C# objects representing the table. The problem I am getting is around the data types specified in the sql generated, specifically strings.
For example:
public virtual string SomeProperty { get; set; }
This translates to a nvarchar(4000) parameter when the query is generated, but this column is a char(6) in the database. Is it possible to specify this some how in the mapping?
I believe there is a performance loss, as sql server is doing a conversion before executing the query.
I've tried this (and it does not work) : http://notherdev.blogspot.com.au/2012/01/mapping-by-code-property.html
Any ideas?