Why would you want to?
null for strings is a perfectly acceptable value since most operations with null strings (like concatenation and various assignments) pretty work the same as "". It's not like FoxPro where NULL breaks other common operations.
That plus check for string.IsNullOrEmpty() which is pretty standard for string empty checks.
Generally ""/string.Empty shouldn't be used unless there's a very specific reason for it.
+++ Rick ---
>Hi everybody,
>
>Do you know if there is any way (or setting) to automatically convert null strings into "" strings?
>
>In our database all character columns are not nullable. We have default values set to be empty string.
>
>So, now using Entity Framework we have the following
>
>public string UserCode { get; set; }
>
>and also
>
>
>Property(x => x.UserCode).IsRequired().HasColumnName("user_code").IsUnicode(false).HasMaxLength(25);
>
>If we remove the IsRequired and attempt to create a new row, then we get the error with inner exception such as
>Cannot insert the value NULL into column 'user_code', table 'SiriusSQL_SysManager.dbo.specials'; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated.
>
>So, I am wondering if there is some relatively simple generic solution to produce empty string instead of the null.
>
>The classes are auto-generated, so this change needs to be auto-generated as well.
>
>Thanks a lot in advance.