mysql - 带有 MySQL MissingManifestResourceException 的实体框架
问题描述
我正在尝试将 .NET Web 服务从 MsSql 迁移到 MySql。我按照本教程中的步骤使 MySql 工作:https ://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html
将 MsSql 数据库结构和数据转换为 MySql 数据库。
当我尝试通过实体(例如db.Languages.FirstOrDefault()
)从 MySql 数据库中获取数据或尝试使用包管理器控制台(例如Update-Database
)执行任何操作时,我总是会遇到此异常:
System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MySql.Data.Entity.EF6.Properties.Resources.resources" was correctly embedded or linked into assembly "MySql.Data.Entity.EF6" at compile time, or that all the satellite assemblies required are loadable and fully signed.
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at MySql.Data.Entity.Properties.Resources.get_NoStoreTypeForEdmType()
at MySql.Data.MySqlClient.MySqlProviderManifest.GetStoreType(TypeUsage edmType)
at System.Data.Entity.ModelConfiguration.Edm.Services.StructuralTypeMappingGenerator.MapTableColumn(EdmProperty property, String columnName, Boolean isInstancePropertyOnDerivedType)
at System.Data.Entity.ModelConfiguration.Edm.Services.PropertyMappingGenerator.Generate(EntityType entityType, IEnumerable`1 properties, EntitySetMapping entitySetMapping, MappingFragment entityTypeMappingFragment, IList`1 propertyPath, Boolean createNewColumn)
at System.Data.Entity.ModelConfiguration.Edm.Services.TableMappingGenerator.Generate(EntityType entityType, DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateEntityTypes(DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel conceptualModel)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized()
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
at System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w)
at System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml)
at System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
我已删除所有迁移和 __MigrationHistory 表。
Visual Studio 2015、.NET 4.5.2、EntityFramework 6.2.0、MySql.Data.Entity.EF6 6.10.7.0、MySql 数据库版本:5.6.15。
请帮我解决这个问题。谢谢!
解决方案
将 MySql.Data.Entity 从 6.10.7 降级到 6.9.12 “解决了”这个问题。
推荐阅读
- javascript - 如何在javascript中将嵌套对象转换为对象数组?
- ios - 从 AVPlayerVideo 中提取图像
- laravel - 当模型尝试在 Laravel 中进行 SELECT 时,会发生“找不到四位数的年份”
- docker - 如何覆盖气流的`docker-compose.yml`中的`command`字段?
- python - 无法使用代理在 Ubuntu 服务器中使用 Selenium 和 python 进行抓取
- java - 我应该使用实例变量还是作为参数传递给方法
- python - 如何将python中的列表与另一个列表进行比较并将其替换为Nan?
- asp.net - 使用 web.config 将 URL 从子文件夹重定向到根目录
- magento2.4 - Magento 2 中由于额外的点前域导致的错误行为
- selenium - 如何验证在 Tosca 的同一测试用例中创建的数据?