i'm coding like below
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddControllersWithViews();
}
but i got a 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
This error occurs when you try to call a method or access a class member that does not exist. The following example generates CS1061 because Person does not have a DisplayName method. It does have a method that is called WriteSomething. Perhaps that is what the author of this source code meant to write.
The definition for AddDatabaseDeveloperPageExceptionFilter does not exist in the IServiceCollection. Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking. Sorry, something went wrong. Sign up for free to join this conversation on GitHub .
Compiler Error CS1061. 'type' does not contain a definition for 'member' and no extension method 'name' accepting a first argument of type 'type' could be found (are you missing a using directive or an assembly reference?). This error occurs when you try to call a method or access a class member that does not exist.
The following example generates CS1061 because Persondoes not have a DisplayNamemethod. It does have a method that is called WriteName. Perhaps that is what the author of this source code meant to write. public class Person { private string _name; public Person(string name) => _name = name; // Person has one method, called WriteName.
After doing some research I found that this is in the Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With