Created
November 26, 2013 16:59
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks for this. Solved my problem. It's absolutely ridiculous that MS hasn't found a solution yet,