EF6 MySQL StrongTypingException表TableDetails中列IsPrimaryKey的值是DBNull

时间:2015-09-10 16:31:52

标签: mysql asp.net-mvc-5 entity-framework-6 visual-studio-2015

我们在VS 2015中使用MySql和Entity FrameWork。

我们已将必要的库导入项目MySQLWeb,MySQL.Data,Mysql.Data.Emtity.EF6。

我遇到的问题是,当我创建ADO.net实体数据模型时,则面临以下错误。有人可以指导吗?

由于以下异常,无法生成模型:

  

' System.Data.StrongTypingException:列的值   ' IsPrimaryKey'在表格' TableDetails'是DBNull。 --->   System.InvalidCastException:指定的强制转换无效。在   Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.TableDetailsRow.get_IsPrimaryKey()   ---内部异常堆栈跟踪结束---在Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.TableDetailsRow.get_IsPrimaryKey()   在   Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateProperties(IList 1 columns, IList 1个错误,列出1& keyColumns, List 1& excludedColumns,   列表1& invalidKeyTypeColumns) at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntityType(IList 1   列,布尔& needsDefiningQuery)at   Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntitySets(IEnumerable的1 tableDetailsRows, EntityRegister entityRegister, IList 1   entitySetsForReadOnlyEntityTypes,DbObjectType objectType)at   Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntitySets(IEnumerable 1 tableDetailsRowsForTables, IEnumerable 1 tableDetailsRowsForViews,   EntityRegister entityRegister)at   Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.Build(StoreSchemaDetails   storeSchemaDetails)at   Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()   在   Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(列出1 errors) at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String storeModelNamespace, ModelBuilderSettings settings, List 1个错误)
  在   Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings   设置,IVsUtils vsUtils,ModelBuilderEngineHostContext   hostContext)'

0 个答案:

没有答案