I have created an ASP.NET Core web application. I am trying to add Entity Framework Core to my solution.
I have installed the below nugets to the project.
- "Microsoft.NETCore.App",
- "Microsoft.AspNetCore.App"
- "Microsoft.EntityFrameworkCore.SqlServer"
There is a DbSet defined in the Context.
In the startup class when i try to add the Db Context, I get the following error in the for "Configuration".
The Name Configuration does not exist in the current context.
My code is:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<MyContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
}
I am following this article which doesn't say much about the configuration
IConfiguration Configurationproperty/field in the startup?