title: How can I create a database in SQL Server by code first entity framework 6?
body: <p>I have an ASP.NET MVC project in VS 2012. I want to use Entity Framework 6 code-first. When I create model and db-context file and when I run my project it does not create any database in my SQK Server. I want to know what is wrong?</p>
  
  <p>I want to know how can I create database by code first in my SQL Server not in SQL Server Express or Compact. How can I create it? I try scaffolding too but it dos not work true and does not create any database. Any tips or trick would be welcome</p>
  
  <p>This is my <code>web.config</code> setting :</p>
  
  <pre><code>&lt;connectionStrings&gt;
     &lt;add name="dbRaja" 
          connectionString="Data Source=hp-PC;Initial Catalog=Raja;User ID=sa;Password=123;MultipleActiveResultSets=True;Trusted_Connection=False;Persist Security Info=True"
          providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt; 
  </code></pre>
  
  <p>and its my datacontext :</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data.Entity;
  using System.Linq;
  using System.Web;
  
  namespace Raja1.Models
  {
      public class dbRaja : DbContext
      {
          // You can add custom code to this file. Changes will not be overwritten.
          // 
          // If you want Entity Framework to drop and regenerate your database
          // automatically whenever you change your model schema, add the following
          // code to the Application_Start method in your Global.asax file.
          // Note: this will destroy and re-create your database with every model change.
          // 
          // System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges&lt;Raja1.Models.Raja1Context&gt;());
  
          public DbSet&lt;Raja1.Models.Spareparts&gt; Spareparts { get; set; }
      }
  }
  </code></pre>