Saturday, March 12, 2022

the name configuration does not exist in the current context Dbcontext .net 6



 

Solution

  • Use builder.Configuration in the code and Nuget Package for Microsoft.Extensions.Configuration 


using Microsoft.Extensions.Configuration;

builder.Services.AddDbContext<ApplicationDbContext>(options =>
{
    options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"));

});





















No comments:

Post a Comment