How can I remove dependencies on unused npgsql references without incurring a MetadataException in an existing EF6 implementation?
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 556
- PR merge metrics
- No merged PRs in 30d
Description
## Ask a question
I have an existing EF6 implementation (.NETFramework 4.8, ASP.NET) with several migrations from multiple years of product development and it used to have a dependency on postgress as we used to support using it as a database option.
Currently we no longer support this option and i would like to remove the library dependencies to reduce our total dependencies.
When i removed the supporting libraries and configuration in my Web.config i am presented with the following error
```
System.Data.Entity.Core.MetadataException: 'Schema specified is not valid. Errors:
(0,0) : error 0175: The ADO.NET provider with invariant name 'Npgsql' is either not
registered in the machine or application config file, or could not be loaded. See the inner
exception for details."
```
As far as i can tell the only way i could clear this error was to re-add the libraries (npgsql and entityframework6.npgsql) and configuration which is not ideal for us, is there a correct way for me to remove these libraries or are we stuck with them now because some of our previous migrations were scaffolded with postgress support?
Contributor guide
Research direction
Inspect the existing Web.config, EF6 migrations, and Npgsql provider configuration to find references that require the provider at metadata-loading time. Reproduce the MetadataException after removing the libraries, then verify that the unused provider dependencies and configuration can be removed without breaking the existing migrations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, postgres
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100