In Move ASP.NET Identity store to EF Sql database zoidbergi described an issue similar to that which I'm experiencing, but which was not completely answered. I am receiving the error above when attempting to migrate from the inbuilt .mdf database to MySQL. I am using a Database-First methodology and have successfully created the Entity Model from the underlying Mysql database.
No matter whether I recreate the asp.net identity datatables the application chokes as soon as user manager is accessed:
The entity type ApplicationUser is not part of the model for the current context.
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.
Exception Details: System.InvalidOperationException: The entity type ApplicationUser is not part of the model for the current context.
Source Error:
Line 65: ' Create a local login before signing in the user
Line 66: Dim user = New ApplicationUser() With {.UserName = model.UserName}
**Line 67: Dim result = Await UserManager.CreateAsync(User, model.Password)**
Line 68: If result.Succeeded Then
Line 69: Await SignInAsync(User, isPersistent:=False)
I have pointed the ApplicationDBContext at my DbContext model:
Public Class ApplicationDbContext
Inherits IdentityDbContext(Of ApplicationUser)
Public Sub New()
MyBase.New("IMSEntities")
End Sub
End Class
Googling tends to find people who have given up and coded up their own security providers - I'd like to use the standard one if possible. Baffled!