Entity Framework Core how to instantiate DBContext using reflection?
I have a NET 7 console app using EF core, I have a situation where I need to instantiate my custom DB Context classes using reflection passing in a DBContextOptions parameter. I am getting the following error when calling Invoke(). Cannot convert DbContextOptions`1 to DbContextOptions`1 Sample code is as follows: public T CreateDBContext<T>(DbContextOptions dbOpts) { … Read more