Skip to main content

All Questions

0 votes
0 answers
38 views

How to use MSOLEDB in .NET Core with Entity Framework

I recently got to know that SQL native client will no longer support from SQL Server 2022 and we may need to upgrade the provider. Please refer to this official Microsoft document: MSDN My application ...
Techie Keeda's user avatar
0 votes
0 answers
27 views

IDbContextFactory for console app and blazor

I have a little problem with DbContext and DbContextFactory. I created a class library to store all the queries to access the database. I want to use that library inside a Blazor App and a Console App....
Niki Gagliardi's user avatar
1 vote
2 answers
54 views

DBContext Configuration is generating a configuration error

I'm trying to use this DbContext in a POST method to add a record. The constructor of the controller with this method is as follows: public CookieController(ILogger<CookieController> logger, ...
John's user avatar
  • 417
0 votes
1 answer
41 views

Entity Framework Core : issue when dynamically updating entities using model builder

I'm currently trying to develop a central app with addons. Central app stores the core entities (like AppEntity, AppRole, Device, ...). It has its own DBContext. I would like to add some entities when ...
Régis's user avatar
  • 245
0 votes
1 answer
137 views

Unit of work with DBContextFactory vs DBContext

I want to implement the Unit of Work pattern in ASP.NET Core & EF Core. My question is whether to use the DbContextFactory or DbContext instance in the unit of work constructor. Which approach is ...
VanasisB's user avatar
  • 101
0 votes
2 answers
83 views

How to inject userManager inside the DbContext constructor?

I'm using IdentityDbContext and I have a SeedData class that I'm using inside the OnModelCreating method to seed the database using the initial migrations as follows: protected override void ...
siba36's user avatar
  • 195
1 vote
1 answer
93 views

Inject IDbContextFactory<ApplicationDbContext> in a constructor waiting for IDbContextFactory<BaseDbContext>

I'm developing an Asp.Net Core Library intended for use across various microservices within my environment. The primary goal of this library is to standardize the code used for database access. I've ...
M. Ozn's user avatar
  • 1,178
1 vote
0 answers
30 views

Issues using IDesignTimeDbContextFactory: Cannot connect to database and ambiguos constructors

I have 3 projects in my solution: Web API, ClassLibrary and MVC. I have a shared DbContext which is located in ClassLibrary. I tried adding a migration in ClassLibrary and that failed because it is ...
iKingNinja's user avatar
0 votes
0 answers
25 views

DbContext get disposed after Grpc request

I'm learning ASP.NET and I'm trying to build a backend e-commerce management, at this point I have a problem with DbContext DI, right after the Grpc request the db context get disposed and it throw a ...
Xaby's user avatar
  • 1
0 votes
1 answer
96 views

EntityFrameworkCore.DbUpdateException: Unable to delete row, SQL Syntax error

I am using an ASP.NET Core Web API with Entity Framework Core (pomelo). I have a MariaDB database. I use Swagger UI to explore my API, as per the template. When I try to use it to delete a row, I get ...
Wolf at the Doors's user avatar
0 votes
1 answer
121 views

Sending parameters to EF Core SqlQuery

Is sending parameters like this with SqlQuery safe against SQL injection? var page_param = new SqlParameter("page_param", page); var pageSize_param = new SqlParameter("pageSize_param&...
Gurhan's user avatar
  • 1
0 votes
0 answers
31 views

Auto-increment composite key that is partitioned by a foreign key in EF Core

I have a table with a composite key of Comment_Id and Prod_Id. Prod_Id is the FK to another table, and I'd like to auto-increment the Comment_Id, but I want it to be partitioned by Prod_Id, so it ...
Chris Reynolds's user avatar
2 votes
0 answers
66 views

How to STOP the ASP.NET Identity API from creating a DbContext on every request when using services.AddDefaultIdentity()?

I am using the ASP.NET Identity API in ASP.NET 8, using the following code in Program.cs: var services = builder.Services; services.AddDbContext<MyDbContext>(); services.AddDefaultIdentity<...
xblz's user avatar
  • 41
0 votes
1 answer
65 views

Sidebar Menu / Index page calling database at the same time error:

I'm running into this error: InvalidOperationException: A second operation was started on this context instance before a previous operation completed. This is usually caused by different threads ...
tvbRPTI2754's user avatar
1 vote
1 answer
561 views

Entity Framework Core issue: 'DbContext' creation error with defined primary key

I'm developing an ASP.NET Core application and encountering an issue with Entity Framework Core. Despite having defined a primary key in my Task entity, I get an error when trying to create an ...
strasouch's user avatar

15 30 50 per page
1
2 3 4 5
23