Skip to content

Multiple ADO Providers found specify provider name or remove unwanted assemblies #402

Description

@digioz

I have an asp.net mvc project which uses 3 different database types depending on which one the user select (MSSQL, MySQL & Oracle). The project follows an Adapter/Repository pattern for it's code. You can see the source code here if it helps:

https://sourceforge.net/p/digioznetportal/codenew/ci/master/tree/Source/3.0.0.0/digioz.Portal/

The problem is in order for me to use both MSSQL and MySQL I have added a reference to both those nugets. But now when trying to get data, the Database.OpenConnection method throws this exception:

Multiple ADO Providers found; specify provider name or remove unwanted assemblies

How can I specify a specific ADO Provider at runtime? I didn't find any methods or constructors on the Database Object itself.

The code in question:

`
public class MySQLData : IDataContext
{
private string connectionString;
private Database Database;

	public MySQLData(string connectionString)
	{
		this.connectionString = connectionString;
		this.Database = Database.OpenConnection(connectionString);
	}

	IMenuRepo IDataContext.Menu()
	{
		var menuRepo = new MenuRepo();

		return menuRepo;
	}
}

`

Thanks,
Pete

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions