In a project I need to set up an ASP.NET MVC (with .NET 4.6.1) but using the "new" EF Core for accessing the database.
Unfortunately every documentation explains only how to setup an ASP.NET Core MVC project.
I just gave it a try and when it comes to creating the database via the Package Manager Console I get the error message:
No parameterless constructor was found on 'DataContext'. Either add a parameterless constructor to 'DataContext' or add an implementation of 'IDbContextFactory' in the same assembly as 'DataContext'
Yes, I don't have a parameterless constructor but neither does the example code of microsoft
public DataContext(DbContextOptions<DataContext> options) : base(options)
{
}
I guess the problem is, that I don't register the DataContext in the Startup.cs which I don't have in an "old" ASP.NET MVC application.
Can anyone help me with this one?