Auto increment column .NET
<p>I have an C# .NET web application and I want to create an auto increment on an id. I can't figure out what I'm doing wrong but I keep getting errors because it doesn't increase.</p>

<p>Error:</p>

<blockquote>
  <p>Cannot insert the value NULL into column 'Id', table 'Samen de Zorg.dbo.BulletinItem'; column does not allow nulls. INSERT fails.<br>
  The statement has been terminated.</p>
</blockquote>

<p>Controller:</p>

<pre><code>    [HttpPost] 
    [ValidateAntiForgeryToken]
    public ActionResult Create([Bind(Include = "UserID,Title,Description")] BulletinItem bulletinItem)
    {
        // 
        if (ModelState.IsValid)
        {
            db.BulletinItem.Add(bulletinItem);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        return View(bulletinItem);
    }
</code></pre>

<p>Model:</p>

<pre><code>    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }
    public string UserID { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
    public virtual ICollection&lt;BulletinReaction&gt; BulletinReaction { get; set; }
</code></pre>

<p>Model in XML:</p>

<pre><code>       &lt;EntityType Name="BulletinItem"&gt;
          &lt;Key&gt;
            &lt;PropertyRef Name="Id" /&gt;
          &lt;/Key&gt;
          &lt;Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" /&gt;
          &lt;Property Name="UserID" Type="nvarchar" MaxLength="256" Nullable="false" /&gt;
          &lt;Property Name="Title" Type="nvarchar" MaxLength="50" Nullable="false" /&gt;
          &lt;Property Name="Description" Type="nvarchar(max)" Nullable="false" /&gt;
        &lt;/EntityType&gt;
</code></pre>

<p>Model in SQL:</p>

<pre><code>CREATE TABLE [dbo].[BulletinItem] 
(
    [Id]          INT            NOT NULL,
    [UserID]      NVARCHAR (256) NOT NULL,
    [Title]       NVARCHAR (50)  NOT NULL,
    [Description] NVARCHAR (MAX) NOT NULL,

    CONSTRAINT [PK_BulletinItem] 
        PRIMARY KEY CLUSTERED ([Id] ASC),

    CONSTRAINT [FK_BulletinItem_AspNetUsers] 
        FOREIGN KEY ([UserID]) REFERENCES [dbo].[AspNetUsers] ([UserName])
);
</code></pre>