I am using Entity Framework Core 2.1.11
I have just initialized a database I will be using in my Website.
I used the Scaffold-DbContext command successfully, and it has now created all the model classes and data context class.
In the StartUp.ConfigureServices I have the following:
public void ConfigureServices(IServiceCollection services)
{
string connection = //correct connection string used in Scaffolding
services.AddDbContext<Models.WebsiteContext>(options => options.UseSqlServer(connection));
services.AddMvc();
}
In my view, I have the following simple thing to test to see if it is working correctly:
@page
@model IEnumerable<Website.Models.Levels>
<table>
@foreach (var item in Model)
{
<tr>
<td>@item.Id</td>
</tr>
}
</table>
But unfortunately I get a cryptic error message that I'm not sure what it means:
To further add: when I debug the project, the constructor of the context does not get hit. I'm not sure why
