title: Using Entity framework with SQL Server 2012 (local *.mdf database)
body: <p>I am trying to create a database in an MVC project. Code-First approach. I wrote my models and a <code>DbContext</code> database. I am having trouble making the connection to the database. My suspect that the problem is in my connection string but I am not sure. the database I want will consist of two tables, which are defined as follows:</p>
  
  <pre><code>public class EmployeeRequest
  {
      [Key]
      public int EmployeeRequestId { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public string UserName { get; set; }
      public int ExtNumber { get; set; }
      public bool isProcessed { get; set; }
      public virtual ICollection&lt;ChangeOrder&gt; ChangeOrders { get; set; }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class ChangeOrder
  {
      [Key]
      public int ChangeOrderId { get; set; }
      public short Operation { get; set; } //0 - Add, 1- delete
      public int TargetExt { get; set; }
      public short Status { get; set; } //0- Pending, 1- Approved, 2- Denied
      public DateTime DtRequested { get; set; }
      public DateTime DtProcessed { get; set; }
      public DateTime DtChangesApplied { get; set; }
      public int EmployeeRequestID { get; set; }
      public virtual EmployeeRequest Request { get; set; }
   }
  </code></pre>
  
  <p>The <code>DbContext</code> class is:</p>
  
  <pre><code>public class RequestsContext : DbContext
  {
      public DbSet&lt;EmployeeRequest&gt; EmployeeRequests { get; set; }
      public DbSet&lt;ChangeOrder&gt; ChangeOrders { get; set; }
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
      }
  }
  </code></pre>
  
  <p>Connection string: </p>
  
  <pre><code>&lt;add name="RequestsContext" 
       providerName="System.Data.SqlClient" 
       connectionString="Data Source=(LocalDb);Database=Requests.mdf;Trusted_Connection=True"/&gt;
  </code></pre>
  
  <p>The error I get says that the connection could not be made to the host. </p>
  
  <p>I am nor sure why this is happening. Any Ideas?   </p>