title: Cannot attach the file *.mdf as database
body: <p>Basically I've followed a tutorial and decided to delete the <code>.mdf</code> file afterwards.</p>
  
  <p>Now whenever I try to run the application I get the following error (the title of this thread).
  The code where I get the error is shown below (ASP.NET MVC 4):</p>
  
  <pre><code>OdeToFoodDB db = new OdeToFoodDB();
  
  public ActionResult Index()
  {
      var model = db.Restaurants.ToList();
      return View(model);
  }
  </code></pre>
  
  <p>My connection string is the following:</p>
  
  <pre><code>&lt;add name="DefaultConnection" 
       connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=OdeToFoodDb;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\OdeToFoodDb.mdf" 
       providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p>I've tried looking at the SQL Server Object Explorer but it looks the following:</p>
  
  <p>Also, in Server Explorer I don't see any data connections.</p>
  
  <p>And when I try to add a new connection in Server Explorer I don't see any databases named <code>OdeToFoodDb</code>.</p>
  
  <p>Sorry for this wide question but I'm new to Entity Framework and don't quite get what's wrong here.</p>