我只是尝试在.Net 4.0
上从EF 4.3升级到EF 5当我使用update-database
运行迁移时,我得到了这个:
System.Data.MetadataException: Schema specified is not valid. Errors:
(0,0) : warning 0005: Could not find schema information for the attribute 'Namespace'.
(0,0) : warning 0005: Could not find schema information for the attribute 'Provider'.
(0,0) : warning 0005: Could not find schema information for the attribute 'ProviderManifestToken'.
(0,0) : warning 0005: Could not find schema information for the attribute 'Alias'.
(0,0) : error 0010: The element Schema in namespace http://schemas.microsoft.com/ado/2009/11/edm/ssdl was unexpected for the root element. The expected Schema in one of the following namespaces: http://schemas.microsoft.com/ado/2006/04/edm/ssdl, http://schemas.microsoft.com/ado/2009/02/edm/ssdl.
at System.Data.Metadata.Edm.StoreItemCollection.Loader.ThrowOnNonWarningErrors()
at System.Data.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths)
at System.Data.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerManifestToken, Memoizer`2& cachedCTypeFunction)
at System.Data.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders)
at System.Data.Entity.Migrations.Extensions.XDocumentExtensions.GetStoreItemCollection(XDocument model, DbProviderInfo& providerInfo)
at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, String connectionString)
at System.Data.Entity.Migrations.DbMigrator.IsModelOutOfDate(XDocument model, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
Schema specified is not valid. Errors:
(0,0) : warning 0005: Could not find schema information for the attribute 'Namespace'.
(0,0) : warning 0005: Could not find schema information for the attribute 'Provider'.
(0,0) : warning 0005: Could not find schema information for the attribute 'ProviderManifestToken'.
(0,0) : warning 0005: Could not find schema information for the attribute 'Alias'.
(0,0) : error 0010: The element Schema in namespace http://schemas.microsoft.com/ado/2009/11/edm/ssdl was unexpected for the root element. The expected Schema in one of the following namespaces: http://schemas.microsoft.com/ado/2006/04/edm/ssdl, http://schemas.microsoft.com/ado/2009/02/edm/ssdl.
在.Net 4.0上以任何方式传递此信息?我知道EF5的某些功能在.Net 4上不可用。但我无法升级到.Net 4.5或VS 2012,因为我的SSD只有60GB,目前它只有4 GB免费,所以VS2012安装程序赢了不要让我安装它(即使在其他驱动器上)。
Web.config引用了这个:
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
答案 0 :(得分:1)
当您使用.NET Framework 4更新数据库时,似乎存储在数据库中的模型具有v3模式。 .NET Framework 4中的EF组件不了解v3(仅v2)模式,因此不了解错误。我相信你需要转向.NET Framework 4.5和VS2012。