Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed upgrading existing solution to EF6 #15

Open
rikbosch opened this issue Nov 20, 2015 · 1 comment
Open

Help needed upgrading existing solution to EF6 #15

rikbosch opened this issue Nov 20, 2015 · 1 comment

Comments

@rikbosch
Copy link

Hello,

We are trying to update our EF5 components to EF6. There is however a problem with the Code First Migrations.

After upgrading the required packages and namespaces according to https://msdn.microsoft.com/en-us/data/upgradeef6.aspx we get the following exception in the package manager console:

System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors: 
(0,0) : error 0175: The ADO.NET provider with invariant name 'ReliableDbProvider.SqlAzure' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.ThrowOnNonWarningErrors()
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths)
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, Boolean throwOnError, IDbDependencyResolver resolver)
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, IDbDependencyResolver resolver, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerInvariantName, String& providerManifestToken, Memoizer`2& cachedCTypeFunction)
   at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders)
   at System.Data.Entity.Utilities.XDocumentExtensions.GetStorageMappingItemCollection(XDocument model, DbProviderInfo& providerInfo)
   at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, Lazy`1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion, String targetModelVersion)
   at System.Data.Entity.Migrations.DbMigrator.Scaffold(String migrationName, String namespace, Boolean ignoreChanges)
   at System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(String migrationName, Boolean ignoreChanges)
   at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder scaffolder)
   at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String migrationName, String language, String rootNamespace, Boolean ignoreChanges)
   at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
   at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Schema specified is not valid. Errors: 
(0,0) : error 0175: The ADO.NET provider with invariant name 'ReliableDbProvider.SqlAzure' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.

I've removed all references to the ReliableDbProvider, but it seems to be cached somewhere in the serialized Code First Migration model. Do you have any solution to the problem?

@robdmoore
Copy link
Member

Hi,

Sorry for the delay. Did you end up solving this problem?

That's a real pain! The serialisation stuff in the code first migrations is a really poor design decision on Microsoft's part. I know they put it in there to try and protect people from themselves, but in my experience it causes more problems than it's worth.

I'm afraid if it's actually in the serialised models then there is no way to fix it apart from either:

  • Re-running all of the migrations again, one-by-one (tedious and dangerous because they will likely have new ids so then you have to be careful to ensure they don't get re-applied in existing environments)
  • Add a provider with the name ReliableDbProvider.SqlAzure that points to the normal Entity Framework provider and see if it all just works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants