mardi 14 avril 2020

How to add DBContext to services from another assembly

on .net core 2.1, I have loaded the assembly to the application using

services.AddMvcCore().AddApplicationPart([Assembly])

But the assembly contains its DB context , the problem is that I am not able to load the DBContext from the assembly, in a similar way of loading the controllers. Typically we add the DB Context using

services.AddDbContext<[DBCOntextType]>([options]);

I cannot get to pass the type to this function (AddDBContext) using reflection

Also if the assembly contains a startup.cs file I am not able to run this startup along with the startup of the main app.

Please let me know if there is a solution Thanks





Aucun commentaire:

Enregistrer un commentaire