I have a system that uses Fluent NHibernate auto mapping. I have a string property that is mapped with a length of 3.
mapping.Map(x => x.CCY1Code).Length(3);
Here is an example of a restriction that I'm building:
Restrictions.Like("CCY1Code", "USD", MatchMode.Anywhere);
Watching this in SQL Server Profiler, it looks like NHibernate is parameterizing the SQL. But in doing so it is limiting it to three characters. But NHibernate is also surrounding my value "USD" with percent signs. So what should be "%USD%" gets truncated to "%US". Here are some snippets from SQL Server Profiler:
CCY1Code like @p9
@p9 nvarchar(3)
@p9=N'%US'
Other than lengthening my field to five characters to work around this, is there any other way to address this problem?