0

I currently have this database table which doesn't allow null in any field, and I'm using Fluent NHibernate mapping the strings into the table. The thing is, when I try submitting an empty string in the HTTP form, the string is parsed as NULL and then saved into the database, which causes the not null constraint failure. So my question is, how can I specify saving NULL as empty string in Fluent NHibernate?

0

1 Answer 1

1

Either you consider null values illegal in your domain model, which means that the input layer should take care to use empty string if the submitted data contains null for technical reasons. Or if you want to allow nulls in the domain model, you should have a custom user type for NHibernate (implement IUserType) to handle the conversions between null and empty strings.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.