ASP.NET/Identity-Fehler: Der Entitätstyp ApplicationUser ist nicht Teil des Modells für den aktuellen Kontext

ImVerschieben Sie den ASP.NET-Identitätsspeicher in die EF SQL-Datenbank Zoidbergi beschrieb ein ähnliches Problem, das ich erlebe, das aber nicht vollständig beantwortet wurde. Ich erhalte die obige Fehlermeldung, wenn ich versuche, von der eingebauten .mdf-Datenbank auf MySQL zu migrieren. Ich verwende eine Database-First-Methode und habe das Entitätsmodell erfolgreich aus der zugrunde liegenden MySQL-Datenbank erstellt.

Egal, ob ich die asp.net-Identitätsdatentabellen neu erstelle, die Anwendung drosselt, sobald auf den Benutzermanager zugegriffen wird:

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)

Ich habe den ApplicationDBContext auf mein DbContext-Modell gezeigt:

Public Class ApplicationDbContext
    Inherits IdentityDbContext(Of ApplicationUser)
    Public Sub New()
        MyBase.New("IMSEntities")
    End Sub
End Class

Googeln findet meist Leute, die ihre eigenen Sicherheitsanbieter aufgegeben und verschlüsselt haben - wenn möglich, möchte ich den Standard verwenden. Verdutzt!

Antworten auf die Frage(2)

Ihre Antwort auf die Frage