jeudi 23 février 2017

Instanciate a sub class using Reflection lateBinding asp.net mvc

Am trying to instaciate a class [that inherits from Dbmigrator class] using reflection and late biding but when i run the code i get this error: Cannot convert the object of type System.RuntimeType to'System.Data.Entity.Migrations.DbMigrationsConfiguration , ok the conversion is not possible how can i do it ?? The exception is raised at the last the last of this code.

. . .

Type[] types = new Type[1];
            Type mConf = pluginToLoad.GetType("AutoamticDbUpdater.MigrationConfig");
            types[0] = mConf;
            Type dbUpdater = pluginToLoad.GetType("AutoamticDbUpdater.DbUpgrader");
            var ctor = dbUpdater.GetC`enter code here`onstructor(types);

           object updater = Activator.CreateInstance(dbUpdater, types);

. . .





Aucun commentaire:

Enregistrer un commentaire