Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fluent NHibernate Column Mapping with Reserved Word

I've read that using a back tick ` should allow for using of reserved words. I'm using SQL Server and Fluent NHibernate and have a column name "File". If I map it with

"`File" 

it tries using

[Fil]

so it's adding the brackets correctly, but dropping the "e" from the end. If I map it as

"`Filee"

it uses

[File]

correctly.

Am I doing something wrong or is this a bug in NHibernate or Fluent Nhibernate?

like image 683
Josh Close Avatar asked Oct 09 '09 17:10

Josh Close


2 Answers

You need to put ` on both sides, like this:

"`File`"

As @Astaar says, the full syntax is:

Map(x => x.File).Column("`File`");
like image 136
Matthew Talbert Avatar answered Sep 19 '22 13:09

Matthew Talbert


To be perfectly clear, the exact syntax would be

Map(x => x.File).Column("`File`");
like image 26
Astaar Avatar answered Sep 19 '22 13:09

Astaar