1
Vote

The entity type User is not part of the model for the current context:Issue

description

Hi
I installed MvcForum through Package Manager Console.
I faced problem while configuring db in my local application.In sqlserver i created an empty db and run the script manually for mvcforum.

Here is my connectionstring: <add name="mvcforum.DataProvider.MainDB" connectionString="Data Source=....\MSSQLSERVER2012;Initial Catalog=Forum1;User ID=sa;Password=aspire@123;" providerName="System.Data.SqlClient"/>

and when i run the app it shows "The entity type User is not part of the model for the current context".

Here is the total stack trace:

[InvalidOperationException: The entity type User is not part of the model for the current context.]
System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType) +208
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +51
System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +138
System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext() +38
System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider() +99
System.Linq.Queryable.Where(IQueryable
1 source, Expression1 predicate) +63
mvcForum.DataProvider.EntityFramework.Repository
1.ReadOne(ISpecification1 spec) in C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.DataProvider.EntityFramework\Repository.cs:74
MVCBootstrap.Web.Security.SimpleMembershipProvider.GetUser(String username, Boolean userIsOnline) in C:\Projects\CreativeMinds\CodePlex\mvcbootstrap\MVCBootstrap\Web\Security\SimpleMembershipProvider.cs:217
mvcForum.Web.Providers.MembershipProviderWrapper.GetUser(String username, Boolean userIsOnline) in C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Providers\MembershipProviderWrapper.cs:188
System.Web.Security.Membership.GetUser(String username, Boolean userIsOnline) +61
System.Web.Security.Membership.GetUser() +19
mvcForum.Web.Controllers.ForumBaseController.OnAuthorization(AuthorizationContext filterContext) in C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Controllers\ForumBaseController.cs:48
System.Web.Mvc.Controller.System.Web.Mvc.IAuthorizationFilter.OnAuthorization(AuthorizationContext filterContext) +10
System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList
1 filters, ActionDescriptor actionDescriptor) +96
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +446
System.Web.Mvc.Async.WrappedAsyncResult1.Begin(AsyncCallback callback, Object state, Int32 timeout) +130
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +302
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +30
System.Web.Mvc.Async.WrappedAsyncResult
1.Begin(AsyncCallback callback, Object state, Int32 timeout) +130
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +382
System.Web.Mvc.Async.WrappedAsyncResult1.Begin(AsyncCallback callback, Object state, Int32 timeout) +130
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +317
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +71
System.Web.Mvc.Async.WrappedAsyncResult
1.Begin(AsyncCallback callback, Object state, Int32 timeout) +130
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +249
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +50
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Source File Information:

Locating source for 'C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Controllers\ForumBaseController.cs'. Checksum: MD5 {47 43 93 2c f5 0 87 e0 76 39 5 75 6f c2 6f 11}
The file 'C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Controllers\ForumBaseController.cs' does not exist.
Looking in script documents for 'C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Controllers\ForumBaseController.cs'...
Looking in the projects for 'C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Controllers\ForumBaseController.cs'.
The file was not found in a project.
Looking in directory 'D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'...
Looking in directory 'D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'...
Looking in directory 'D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'...
Looking in directory 'D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'...
Looking in directory 'D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Controllers\ForumBaseController.cs.
The debugger could not locate the source file 'C:\Projects\CreativeMinds\CodePlex\mvcforum\mvcForum.Web\Controllers\ForumBaseController.cs'

Call Stack Location:
mvcForum.web.dll!mvcForum.web.Controllers.ForumBaseController.OnAuthorization(System.web.mvc.AuthorizationContext filterContext) Line 48

Please help me at the earliest i stuck here..

Thanks
Subhadarsini

comments