Using SQL and EF 6 (C#), I have read multiple posts on this but with no clear solution.
The problem is simple, I want to have a 'default unless otherwise provided' value in the database.
So, I set the default in the database like so:
[notification_sent] BIT NULL DEFAULT ((0)),
Then turn the StoreGeneratedPattern
to 'Computed' in the EDMX (using database first).
Is there not a way to now set this field to true?
Below is what the Properties looks like from in VS.
If I put this property back to 'none' then it overwrites the value with NULL if I do not provide a value in my code vs using the Default value of 0 as set in the database.
It seems to me that it should be filling in the 'Default Value' field here when it (Visual Studio) generates the .edmx from the database.
I have tried setting 'Nullable' in the above properties to 'true' and it still shows the exact same as before:
public Nullable<bool> notification_sent { get; set; }
In the generated .cs
If I manually insert a value of 'false' in the 'Default Value' field it add the below:
this.notification_sent = false;
But will this not be overwritten when ever I do a refresh from the database?