I had a project working with EF 6.0.2 but now I get an error with EF 6.1:
An exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred in EntityFramework.dll but was not handled in user code
Additional information: An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
The provider did not return a ProviderManifestToken string.
{"Unable to determine the provider name for provider factory of type 'System.Data.SqlClient.SqlClientFactory'. Make sure that the ADO.NET provider is installed or registered in the application config."}
Any idea what might be wrong? I am not sure where to look.
My DBContext is as follows:
public class Context : DbContext {
public Context()
: base() {
Configuration.With(x => {
x.LazyLoadingEnabled = false;
});
} // Context
public DbSet<User> Users { get; set; }
protected override void OnModelCreating(DbModelBuilder builder) {
builder.Configurations.With(x => { x.Add(new UserMapper()) });
}
}
And on my Web.Config I have the following:
<add name="Context" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Database=MYDB;Trusted_Connection=true;" />
I am injecting the Context in a Repository using StructureMap:
For<DbContext>().HybridHttpOrThreadLocalScoped().Use(() => new Context());
For<IRepository>().Transient().Use<Repository>();
Thank You, Miguel