C
C#12mo ago
FanLife

Unable to create an object of type 'DBCSDBContext'. For the different patterns supported at design t

Hey I've developed an application using Entity Framework Core and PostgreSQL, and I've encountered an error that I can't seem to resolve. When I try to create an instance of the 'DBCSDBContext' class, I receive the following error message: "Unable to create an object of type 'DBCSDBContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728". Here's some relevant information about my project: I'm using .NET 6.0 framework. The NuGet packages I've referenced in my project are as follows: Microsoft.EntityFrameworkCore.Design version 6.0.12 Microsoft.Extensions.Configuration version 6.0.1 Microsoft.Extensions.Configuration.Json version 6.0.0 Npgsql.EntityFrameworkCore.PostgreSQL version 6.0.8 I've checked my DbContext implementation, the configuration of my database connection string, and the project references, but I haven't been able to solve the problem.
2 Replies
Pobiega
Pobiega12mo ago
Show your context constructor and DI registration And how you try to create a new one
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.