FluentNHibernate exception when there are slash in the default value

24 Views Asked by At

I have been trying to map a string value using FulentNHibernate like below.

 Map(x => x.FilePath).Length(500).Not.Nullable().Default(@"C:\Program Files\server\data\conf\groups.txt");

But this gives an error. If I add text without slashes it works. Is there a specific way to add text with slashes? I have also tried double slashes.

1

There are 1 best solutions below

0
Kavin404 On

Finally found the correct way to put it. Note the additional quotes without them it won't work

 Map(x => x.FilePath).Length(500).Not.Nullable().Default("\"\'C:\\Program Files\\server\\data\\conf\\groups.txt\'\"");