title: The entity type ApplicationUser is not part of the model for the current context is thrown when adding a user
body: <p>I have read through a lot of posts in regards to this error, and the majority all say the same thing about it being about the connectionstring in the AppConfig, that it shouldn't be an EF connectionstring but a plain old sql connection string. I have made sure that the connectionstring is correct and that I am using a SQL Connection string but I still keep getting the error...
  This is the code</p>
  
  <pre><code>public void RegisterDealer(RegisterAdministrator model)
      {
          var user = new ApplicationUser { UserName = model.administratorName, Email = model.administratorEmail, AccountNumber = model.AccountNumber, LoginUserName = model.LoginUserName };
  
          ApplicationDbContext dbc = new ApplicationDbContext();
  
          PasswordHasher MyPasswordHash = new PasswordHasher();
  
  
  
          user.PasswordHash = MyPasswordHash.HashPassword(model.administratorPassword);
          user.SecurityStamp = Guid.NewGuid().ToString();
          user.LockoutEnabled = true;
          user.AccountNumber = "1";
          user.IsActive = true;
  
  
          dbc.Users.Add(user);
          dbc.SaveChanges();
  
          AdvancewareIdentity ICE = new AdvancewareIdentity();
          AspNetUserRole AUR = new AspNetUserRole();
  
          AUR.UserId = user.Id;
          // Dealer RoleID
          // 8870ccb1-8ced-4703-a6bd-303c5ff5faf7
  
          AUR.RoleId = "8870ccb1-8ced-4703-a6bd-303c5ff5faf7";
  
          ICE.AspNetUserRoles.Add(AUR);
          ICE.SaveChanges();
  
  
          //UserManager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking &lt;a href=\"" + id + "\"&gt;here&lt;/a&gt;");
      }
  </code></pre>
  
  <p>The error is right at</p>
  
  <pre><code>    dbc.Users.Add(user);
  </code></pre>
  
  <p>The StackTrace is this..</p>
  
  <pre><code>at System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType)
  at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
  at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
  at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
  at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
  at System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
  at System.Data.Entity.DbSet`1.Add(TEntity entity)
  at AdvanceWareDAL.Authentication.AdministrationAccountController.RegisterDealer(RegisterAdministrator model) in c:\AdvanceWareRevision\AdvanceWareDAL\Authentication\AdministrationAccountController.cs:line 306
  at AdvanceWareDAL.Authentication.OQOEDAL.AddNewDealer(NewDealer dealer) in c:\AdvanceWareRevision\AdvanceWareDAL\Models\OQOEDAL.cs:line 599
  at AdvanceWareDAL.OQOEAdminstrationDAL.AddNewDealerFromAdministration(NewDealer dealer, String loggedinuser) in c:\AdvanceWareRevision\AdvanceWareDAL\OQOEAdminstrationDAL.cs:line 96
  at AdvanceWareMVC.Controllers.AdministrationController.AddNewDealer(NewDealer dealer) in c:\AdvanceWareRevision\AdvanceWareMVC\Controllers\AdministrationController.cs:line 133
  at lambda_method(Closure , ControllerBase , Object[] )
  at System.Web.Mvc.ActionMethodDispatcher.&lt;&gt;c__DisplayClass1.&lt;WrapVoidAction&gt;b__0(ControllerBase controller, Object[] parameters)
  at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
  at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.ActionInvocation.InvokeSynchronousActionMethod()
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.&lt;BeginInvokeSynchronousActionMethod&gt;b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
  at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3d()
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f()
  </code></pre>
  
  <p>Does anyone see something that I am missing or an idea on what to look at to resolve this issue?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here is the code for the DbContext</p>
  
  <pre><code>    public class ApplicationDbContext : IdentityDbContext&lt;ApplicationUser&gt;
      {
          public ApplicationDbContext()
              : base("AdvancewareIdentity", throwIfV1Schema: false)
          {
          }
  
          public static ApplicationDbContext Create()
          {
              return new ApplicationDbContext();
          }
      }
  </code></pre>