title: The entity type [xxx] is not part of the model for the current context
body: <blockquote>
    <p>Blockquote</p>
  </blockquote>
  
  <p>I been going at this problem for a few days now.  I'm trying to create a db connection using Visual Studio 2010 MVC2 EF 6.0.  I can connect to the DB using the server explorer.  </p>
  
  <p>Here is what I done so far:</p>
  
  <ol>
  <li>Created a Model: ModelEntities.edmx (connects to a SQL Server DB)</li>
  </ol>
  
  <p><strike>
  2. Created a Model for the table I'm trying to access:  Table.cs ( has all the public members)</p>
  
  <pre><code>public class Quickfix
  {
  
      public int FIX_ID { get; set; }
      public string NAME { get; set; }
      public string TYPE { get; set; }
      public string DESCRIPTION { get; set; }
  }
  </code></pre>
  
  <ol>
  <li><p>Created a DAL folder and added my context to it: (ModelEntitesContext.cs )</p>
  
  <p>using ServiceDesk_Solution.Models;</p>
  
  <p>namespace ServiceDesk_Solution.DAL{</p>
  
  <pre><code>   public class ModelEntitiesContext : DbContext
     {
         public ModelEntitiesContext() : base("ModelEntities") { }
         public DbSet&lt;Quickfix&gt; Quickfixs { get; set; }
     }
  }
  </code></pre>
  
  <p></strike></p></li>
  <li><p>I created a controller for my View: (Called my controller DBController.cs)</p>
  
  <p>public class DBController : Controller
  {
      //
      // GET: /DB/</p>
  
  <pre><code>&lt;strike&gt;ModelEntitiesContext db = new ModelEntitiesContext ();&lt;/strike&gt;
  ModelEntities db = new ModelEntities();
  
  public ActionResult DB()
  {
  
      return View(db.Quickfix.ToList(););
  }
  </code></pre>
  
  <p>}</p></li>
  <li><p>Finally I create a strong view using my Model <strike>(DB.aspx)</strike> ModelEntities.Quickfix <strike>and this is when I get the context error (see error and stack trace bellow)</strike></p></li>
  <li><p>My config file:</p>
  
  <p>add name="ModelEntities" connectionString="metadata=res://<em>/Models.CSCEntities.csdl| res://</em>/Models.ModelEntities.ssdl| res://*/Models.ModelEntities.msl; provider=System.Data.SqlClient; provider connection string=&quot; data source=devsql;initial catalog=Model; persist security info=True;user id=user;password=password; multipleactiveresultsets=True; App=EntityFramework&quot;" providerName="System.Data.EntityClient"</p></li>
  </ol>
  
  <p><strong>No more error</strong></p>
  
  <p><strike>Error Message:</p>
  
  <pre><code>The entity type Quickfix is not part of the model for the current context. 
  </code></pre>
  
  <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.InvalidOperationException: The entity type Quickfix is not part of the model for the current context.</p>
  
  <pre><code>Source Error: 
  
  
  Line 14:         public ActionResult DB()
  Line 15:         {
  Line 16:             db.Quickfix.ToList();
  Line 17:             return View();
  Line 18:         }
  
  
  
  Source File: ***_Solution\Controllers\DBController.cs    Line: 16 
  
  Stack Trace: 
  
  
  [InvalidOperationException: The entity type Quickfix is not part of the model for the current context.]
     System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType) +191
     System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +46
     System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +125
     System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +33
     System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable&lt;TResult&gt;.GetEnumerator() +100
     System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +315
     System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
     ServiceDesk_Solution.Controllers.DBController.DB() in ***_Solution\ServiceDesk_Solution\Controllers\DBController.cs:16
     lambda_method(Closure , ControllerBase , Object[] ) +96
     System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +51
     System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +409
     System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +52
     System.Web.Mvc.&lt;&gt;c__DisplayClassd.&lt;InvokeActionMethodWithFilters&gt;b__a() +127
     System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +436
     System.Web.Mvc.&lt;&gt;c__DisplayClassf.&lt;InvokeActionMethodWithFilters&gt;b__c() +61
     System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +305
     System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +830
     System.Web.Mvc.Controller.ExecuteCore() +136
     System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +111
     System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39
     System.Web.Mvc.&lt;&gt;c__DisplayClass8.&lt;BeginProcessRequest&gt;b__4() +65
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass1.&lt;MakeVoidDelegate&gt;b__0() +44
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass8`1.&lt;BeginSynchronous&gt;b__7(IAsyncResult _) +42
     System.Web.Mvc.Async.WrappedAsyncResult`1.End() +141
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +54
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
     System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +52
     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8981789
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +184
  
  
  
  
  --------------------------------------------------------------------------------
  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 
  </code></pre>
  
  <p></strike></p>