✅ System.InvalidOperationException: No database provide has been configured for this DbContext
It is all about this newbie error
I have no clue what triggered all this. Could kindly point me in the right direction?
https://pastebin.com/RbkExv6j This is full code and full exception message for your reference.
Pastebin
/*Model */using System.ComponentModel.DataAnnotations;namespace CRU...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
2 Replies
it's been a while since i messed around with ef core, but two things stand out to me
1. you use both .AddDbContext in your program.cs and then also override OnConfiguring in your JsonContext
2. your JsonContext defines a parameterless constructor
what happens if you leave the .AddDbContext call, but remove the OnConfiguring override and parameterless constructor?
that is, only leaving this ctor:
public JsonContext(DbContextOptions<JsonContext> options)
: base(options)
{
}
you are also using two different providers?
and
MySql and SqlServer are not the same