Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any setting to convert null strings to empty automatical
Message
 
 
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01608410
Message ID:
01608532
Views:
28
>>>Isn't that MVC code? I'm not sure of my ground here but that should give empty strings in the EF model - but EF will still try to convert the empty string to null when pushing to the DB unless told otherwise.
>>>
>>I am not sure I understand you. I just know that this code seems to make no difference and the error remained. I was looking into the getter for the property, but I don't know if I should be doing it or should I let my colleague to handle the issue.
>>
>>Hopefully we'll figure this out today in the daily standup meeting.
>
>As I understand it the code you posted controls how the model is updated from the HTML - so you should be sure of having empty strings and not null at that point. But you still need to use ConvertEmptyStringsToNull(false) to prevent EF converting those empty strings back to null on the DB.

Viv,

I can not figure out where to set this property. This is the class code we have, I don't see this property in Intellisense, so I don't know how to set it:
public abstract class DbContextBase : DbContext, IContext
    {
        protected DbContextBase(string connection)
            : base(connection)
        {
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.LazyLoadingEnabled = false;
           
        }
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform