In MVC 3, how do you make model model bindings by default treat empty lines as "Empty" rather than "NULL"?

I am using Entity Framework Code-First with POCOs to interact with the database. I have a field that is not necessarily called a "Title".

When I get an object from a form, the default mediator automatically makes "Title" null instead of empty.

How do I get model binding to return an empty string instead of a null?

Thanks for any help

+5
source share
2 answers

, . , CreateModel - , , base.CreateModel .

.

+5

, MVC4 POCO:

[DisplayFormat(ConvertEmptyStringToNull = false)]
+10

All Articles