Entity Framework adds Default value by itself <p>i have the following table definition (trimmed):</p> <pre><code>CREATE TABLE `mt_user` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `dtUpdated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `idUpdatedBy` int(10) unsigned NOT NULL, `dtCreated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `idCreatedBy` int(10) unsigned NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; </code></pre> <p>As you can see, no default value was assigned to <code>idUpdatedBy</code> and <code>idCreatedBy</code>.</p> <p>When trying to insert a row from workbench, it fails (since i do not provide <code>idCreatedBy</code> or <code>idUpdatedBy</code>). Which is the correct behaviour.</p> <p>On the other hand, if i use a simple form to insert using Entity Framework, the fields are populated with a <code>0</code> value, even though i have not defined a default value (neither in entity framework).</p> <p>i was expecting Entity Framework to fail the insert and throw an error about <code>idUpdatedBy</code>/<code>idCreatedBy</code> not having a value.</p> <p>Could someone explain this behaviour and how to fix it?</p>