C
C#6mo ago
RXPHXEL

✅ In Identity Model class i am having CS1729 coded error message.

Hi, I am trying to build a simple library management system using asp.net but Identity Model is giving me CS1729 error, I googled but couldn't find a solution to it. I have added my "Books" class and "Identity Models" to attachments, could you please give me a tip about how can I solve this error. ( I tried to write it as "public ApplicationDbContext() : base("DefaultConnection", false)" and "public ApplicationDbContext() : base("DefaultConnection")" but in that case gave me other errors as well.) Thank you.
No description
No description
No description
10 Replies
Angius
Angius6mo ago
I mean, the error is quite clear here DbContext constructor does not take two arguments What would this throwIfv1Schema do, if it existed?
RXPHXEL
RXPHXELOP6mo ago
Takes connection string
RXPHXEL
RXPHXELOP6mo ago
After deleting it it says this whenever I try to add MVC controler with views using entity framework
No description
RXPHXEL
RXPHXELOP6mo ago
And I cannot add my model and DBContext Classes to controllers
No description
zuzaki
zuzaki6mo ago
You need to either register the DbContext as a service or override OnConfiguring. Take a look at the documentation here: https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=visual-studio
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
or
builder.Services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("SchoolContext")));
builder.Services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("SchoolContext")));
Getting Started - EF Core
Getting started tutorial for Entity Framework Core
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
RXPHXEL
RXPHXELOP6mo ago
@TeBeCo thank you so much
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX6mo ago
If you have no further questions, please use /close to mark the forum thread as answered
RXPHXEL
RXPHXELOP6mo ago
Documentation helped tbh
Want results from more Discord servers?
Add your server