Say, I have a table in the DB defined as follows
PkId - int, primary, autoincrement
Bar - int, allow null=false, no default
Now when generating the EF model from the database the 'Bar' field is correctly defined as Nullable=false, Type=Int32.
Now when I do the following
var foo = new Foo(); context.AddToFoos(foo); context.SaveChanges();
The row is inserted into the database and 'Bar' has a value of 0? I would have expected an exception because Bar hasn't been set. I realise that 0 isn't null but its also not a value that I've set.
Is this by design or have I misunderstood something?