I posted this once, but I was a bit too vague in my information, so I am trying again.
nHibernate
/Fluent nHibernate
seems to be truncating, or 'stripping' certain characters from strings that I submit to my database. For example, if I submit the string This\nis\na\nblock\nof\ntext\n\with\nreturns
, the \n
symbol represents the carriage returns. I want these to stay intact, because later, when the data is read back out, that is when it will be parsed by MarkdownDeep
However, I have noticed that the \n
symbol specifically gets 'stripped' when the database does its commit. I have performed debugging all the way up to ISession.SaveOrUpdate(object)
and I can confirm that the data is unaltered up to the point I can visibly follow the debugging. But then I go and look at the record in the database, and it has been stripped of this symbol.
If I use String.Replace("\n","\\n"))
on the text, it will actually work right. But this does not seem like an intelligent way to go about storing everything. This means I have to continuously remember what fields may have this problem and do in-between logic.
Is there a setting I am missing in nHibernate/Fluent nHibernate
that is forcing it to strip this data?
Debugged Code Path
Following the path of my code, it goes like this.
ASP.NET MVC View (textarea) -> This\nis\na\nblock\nof\ntext\n\with\nreturns
ASP.NET MVC Model (Json) -> This\nis\na\nblock\nof\ntext\n\with\nreturns
ASP.NET MVC Controller Parameter -> This\nis\na\nblock\nof\ntext\n\with\nreturns
ISession.SaveOrUpdate -> This\nis\na\nblock\nof\ntext\n\with\nreturns
Database Record -> This is a block of text with returns
So the problem is obviously happening at the ISession
level.