DB default value ignored when creating Entity Framework model
<p>Assuming I have the following table in my DB:</p>

<pre><code>CREATE TABLE [dbo].[Test]
(
    [Id]      INT            IDENTITY (1, 1) NOT NULL,
    [Active]  BIT            DEFAULT ((1)) NOT NULL,
)
</code></pre>

<p>When creating an EF model from this DB, the mapping for the <code>Active</code> <em>bit column</em>, which is mapped to a <code>Boolean</code> column, has no default value (see property "Default Value):
<a href="https://i.stack.imgur.com/Z3qwT.png" rel="nofollow"><img src="https://i.stack.imgur.com/Z3qwT.png" alt="Property View - Model Diagram"></a></p>

<p>Why does Entity Framework behave that way? Why doesn't the default value that is defined in the database automatically be applied in the model when the model gets created? The DB states that the default value should be <code>1</code>, which I assumed would be a default value of <code>true</code> in the model. Do I really have to set the default value for all my columns in the model again?</p>

<p>I checked this behaviour for <em>int</em> and <em>bit</em> columns.</p>

<hr>

<p>I did some more investigation, and tried to set the "Default Value" property by hand to <code>True</code> and <code>true</code>, and both works.</p>

<p><a href="https://i.stack.imgur.com/uJKro.png" rel="nofollow"><img src="https://i.stack.imgur.com/uJKro.png" alt="Manually changed default value"></a></p>

<p>The auto-generated constructor for the Test-entity changes from</p>

<pre><code>public Test()
{
}
</code></pre>

<p>to</p>

<pre><code>public Test()
{
    this.Active = true;
}
</code></pre>

<p>So default values would be possible in EF, but they are not set when generating the model based on database-first, at least not on my machine.</p>

<p>So, <strong>the question still remains</strong>: Do I really have to set the default value for all my columns in the model again, even if they are already set in the DB?</p>