日期:2014-05-17  浏览次数:20413 次

mvc 3 报错了
用户代码未处理 System.NotSupportedException
  Message=Model compatibility cannot be checked because the EdmMetadata type was not included in the model. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.
  Source=EntityFramework
  StackTrace:
  在 System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata)
  在 System.Data.Entity.Database.CompatibleWithModel(Boolean throwIfNoMetadata)
  在 System.Data.Entity.DropCreateDatabaseIfModelChanges`1.InitializeDatabase(TContext context)
  在 System.Data.Entity.Database.<>c__DisplayClass2`1.<SetInitializerInternal>b__0(DbContext c)
  在 System.Data.Entity.Internal.InternalContext.<>c__DisplayClass5.<PerformDatabaseInitialization>b__3()
  在 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
  在 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
  在 System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
  在 System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
  在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
  在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
  在 System.Data.Entity.Internal.InternalContext.Initialize()
  在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
  在 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
  在 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
  在 System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
  在 System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
  在 System.Data.Entity.DbSet`1.Add(TEntity entity)
  在 XiAnITCommunity.Controllers.FiledTypesController.Create(FieldTypes fid) 位置 D:\XiAnITCommunity\XiAnITCommunity\XiAnITCommunity\Controllers\FiledTypesController.cs:行号 35
  在 lambda_method(Closure , ControllerBase , Object[] )
  在 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
  在 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
  在 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
  在 System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
  在 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
  InnerException: 


------解决方案--------------------
是你的Entity Framework并没有这个数据实体模型