Exception : EntityFramework Core exception on UseSqlServer

.net asp.net-core c# entity-framework entity-framework-core

Question

I have this code :

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
  base.OnConfiguring(optionsBuilder);

  optionsBuilder.UseSqlServer("MyConnectionString"); //Exception here
}

At runtime I get an exception :

Error CS0012: The type 'DBConenction' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Common, version=4.1.0.0

I tried to upgrade all packages, add a reference to System.Data.Common 4.1.0.0 I tried higher version too with the same result. I tried with .NET Core 2.0 finalpreview1 I get the same problem. I tried several solution found on the web but without success.

Any idea ?

Thanks,

1
0
5/29/2017 7:00:01 AM

Popular Answer

Read the following documentation and be sure to install all the packages mentioned:

Microsoft EF Core

0
5/29/2017 4:07:28 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow