Code:
代码:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddControllersWithViews();
}
Error message:
错误信息:
Error CS1061 'IServiceCollection' does not contain a definition for 'AddDatabaseDeveloperPageExceptionFilter'
and no accessible extension method 'AddDatabaseDeveloperPageExceptionFilter' accepting a first argument of type
'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
AspCore_DB C:\Startup.cs 30 Active
This code is officially introduced in the MS guide and I just followed. I'm working on MS Visual Studio 2019 v16.8.2.
这段代码是在微软指南中正式介绍的,我刚才也跟着读了。我正在开发MS Visual Studio 2019 v16.8.2。
更多回答
优秀答案推荐
After doing some research I found that this is in the Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore library.
在做了一些研究后,我发现它在Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore库中。
guys you can install this package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 7.0.10 from -tools -> Nuget Package Manager -> Manage Nuget Package for Solution, this works for me.
伙计们,您可以安装这个包Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 7.0.10从-工具->Nuget包管理器->管理Nuget包的解决方案,这对我很管用。
更多回答
我是一名优秀的程序员,十分优秀!