Skip to content

Instantly share code, notes, and snippets.

@brainwipe
Created November 26, 2013 16:59
Show Gist options
  • Save brainwipe/7661942 to your computer and use it in GitHub Desktop.
Save brainwipe/7661942 to your computer and use it in GitHub Desktop.
Entity Framework 6 is unable to locate the SqlProvider when running integration tests on a server. This is because it is not copied across to the bin/ folder (no matter what you do). This is the hack to ensure the DLL is moved over. Placed in your base domain context that wraps System.Data.Entity.DbContext.
public abstract class BaseDomainContext : DbContext
{
static BaseDomainContext()
{
// ROLA - This is a hack to ensure that Entity Framework SQL Provider is copied across to the output folder.
// As it is installed in the GAC, Copy Local does not work. It is required for probing.
// Fixed "Provider not loaded" error
var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
}
}
@Vlandmist
Copy link

thanks for this. Solved my problem. It's absolutely ridiculous that MS hasn't found a solution yet,

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