I have an application that includes a Web API Core startup project. I found that I cannot scaffold an existing database in .Net Core for a View. So I decided for my Web API Core application that I will have to use the .Net framework and get the data in a project using EF6. However in the startup project (Web API Core) I need to set the connection string. For this I need EF6, and it would seem that I cannot do this even if I add EF6 in the project (maybe this can't be done in a Core project?). So this code fails where I attempt to add the context;
public void ConfigureServices(IServiceCollection services)
{
services.AddMvcCore()
.AddMvcOptions(o => o.OutputFormatters.Add(
new XmlDataContractSerializerOutputFormatter()));
var connectionString = Startup.Configuration["connectionStrings:propertiesConnectionString"];
services.AddDbContext<SurveyEntities>(o => o.UseSqlServer(connectionString));
services.AddScoped<IPropertiesRepo, PropertiesRepo>();
}
If I download EF6, I get this error;
Error CS0311 The type 'Properties.EF6.MSurveyV2Entities' cannot be used as type parameter 'TContext' in the generic type or method 'EntityFrameworkServiceCollectionExtensions.AddDbContext(IServiceCollection, Action, ServiceLifetime)'. There is no implicit reference conversion from 'Properties.EF6.MSurveyV2Entities' to 'Microsoft.EntityFrameworkCore.DbContext'.
So how do I fix this?