. Advertisement .
..3..
. Advertisement .
..4..
I meet this error message: the entity type is not part of the model for the current context. However, I am a newbie in solving program problems. I need everyone advice to fix it effectively. I look forward to seeing your comments. Thanks in advance.
This is the ExceptionType:
System.InvalidOperationException
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
vid System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
vid System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()
--- Slut på stackspårningen från föregående plats där ett undantag utlöstes ---
vid System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
vid System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
vid System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()
--- Slut på stackspårningen från föregående plats där ett undantag utlöstes ---
vid System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
vid System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
vid System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()
The cause: The MVC entity framework connection string contains incorrect meta data. Several entity models for several databases were used in the project. The connection strings, however, had been replicated to the other databases, and the database settings and credentials had been modified. But neglected to change the names of the entity models in the connectionstring’s meta data part.
Solution:
Names of database models in connection strings should be updated to fix the error the entity type is not part of the model for the current context.