Archive for the ‘Entity Framework’ Category

Entity framework problem : EntityFramework.SqlServer’ registered in the application config file for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ could not be loaded

September 27, 2016

EntityFramework.SqlServer’ registered in the application config file for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ could not be loaded
See: http://stackoverflow.com/questions/21175713/no-entity-framework-provider-found-for-the-ado-net-provider-with-invariant-name
I followed their advice in my dbContext class
///

/// A partial class extention to the auto generated code created by Entity Framework.
/// this allows us to create a normal connection string, then create an entity connection string, and pass it into the
/// entity data model.
/// So we can use DEV, QA, and PROD versions of our database based on switches in our config file.
///

public partial class SoftwareCatalogEntities : DbContext
{
private volatile System.Type _dependency;
// http://stackoverflow.com/questions/21175713/no-entity-framework-provider-found-for-the-ado-net-provider-with-invariant-name

///

/// An additional Constructor for the Entity Framework Model
/// that allows us to customize the connection String before a
/// context is created and returned.
///

/// Modified connection string instead of default connection string used by default constructor that takes no parameters.
public SoftwareCatalogEntities(string EntityConnectionString) : base(EntityConnectionString)
{
_dependency = typeof(System.Data.Entity.SqlServer.SqlProviderServices); // will cause the sql server dll to be copied
}

Advertisements