lundi 22 avril 2019

Load and Unload assembly with dependencies using reflection

I am trying to Load an assembly of Entity Framework Library and calling ToList on one of its property.

Finally I did it. I need to Invoke this on multi databases for applying migration on them.

So I need different Connection String on each call and because they should rub in a loop because there are some file updates and etc, the c# will cache the loaded assemblies and when I changing the Connection String at runtime and refresh the configuration, the migration again applying for first ConnectionString on Loading Assemblies for first time.

I trying MarshalByRef and its failed because my library of EF is not Serialize able . So I can't Load assemblies in different Application Domain.

For your information my project is a win-form application.

Regards





Aucun commentaire:

Enregistrer un commentaire