Table Definition

Model Definition

Code
using MyRandomizer.Models;
namespace MyRandomizer
{
class Program
{
static void Main(string[] args)
{
using (Database1Entities db = new Database1Entities())
{
Category c = new Category();
c.Name = "Integral";
db.Categories.AddObject(c);
db.SaveChanges();
}
}
}
}
Output

Question
Why does my default value column automatically get populated by a date of January 1, 0001?
If you set
StoreGeneratedPattern="Computed"in designer it is only included in conceptual model (CSDL). But you also need this in storage model (SSDL). If you don’t do it EF will generate INSERT statement which will contain current value of date which isDataTime.MinValue. Storage model cannot be edited from designer. You must open EDMX file as XML and manually update row definition.Final definition should look like:
But this solution has one big problem. Once you manually modify SSDL part you should not use “Update from database” or you will have to perform this change after each call of “Update from database”. The reason is that “Update from database” deletes current SSDL part of EDMX and creates new one based on current DB structure.