C
C#3mo 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
Angius3mo 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
RXPHXEL3mo ago
Takes connection string
RXPHXEL
RXPHXEL3mo ago
After deleting it it says this whenever I try to add MVC controler with views using entity framework
No description
RXPHXEL
RXPHXEL3mo ago
And I cannot add my model and DBContext Classes to controllers
No description
zuzaki
zuzaki3mo 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 User3mo ago
Message Not Public
Sign In & Join Server To View
RXPHXEL
RXPHXEL3mo ago
@TeBeCo thank you so much
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX2mo ago
If you have no further questions, please use /close to mark the forum thread as answered
RXPHXEL
RXPHXEL2mo ago
Documentation helped tbh
Want results from more Discord servers?
Add your server