To access data from a controller, you need to declare an instance of the ApplicationDbContext class. I want to do this in the default constructor, but I get an error. I took an example from here tyts

 public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base("DefaultConnection") { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer(@"server=10.28.16.200;Integrated Security=false;User Id=test; Password=pass;database=Zaya"); } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); base.OnModelCreating(builder); } } 

Here are the contents of appsettings.json

  "Data": { "DefaultConnection": { "ConnectionString": "server=10.28.16.200;Integrated Security=false;User Id=test; Password=Radzhab90;database=Zayavki" } 

This is the error that is encountered. Error CS1729 'IdentityDbContext' does not contain a constructor that takes arguments 1.

    1 answer 1

    In the source you specified, a basic constructor with two parameters is actually used, you missed the second parameter (throwIfV1Schema). from 'tyts'

    • It turns out I used Identity3) and in the examples Identity2 - Radzhab
    • Not entirely clear - is the problem solved? - ale
    • @ale Please insert sample code as text, not images - Nicolas Chabanovsky
    • @NicolasChabanovsky is not my code, but just a quote from the link of the question given by the author (and there is also an image there), i.e. I just drew the author's attention to his own information - ale