/// <summary> /// Initializes a plugin and gives it a chance to perform any database operations. /// </summary> /// <param name="databaseFacade">The database facade.</param> /// <param name="plugin">The plugin to be initialized.</param> public static void InitializePlugin(this DatabaseFacade databaseFacade, EntityPlugin plugin) { var currentContext = ((IInfrastructure <IServiceProvider>)databaseFacade).Instance.GetService <ICurrentDbContext>(); var context = ( EntityDbContext )currentContext.Context; plugin.Initialize(context); }
/// <summary> /// Migrates a plugin to the latest version possible. /// </summary> /// <param name="databaseFacade">The database facade.</param> /// <param name="plugin">The plugin to be migrated.</param> public static void MigratePlugin(this DatabaseFacade databaseFacade, EntityPlugin plugin) { var migrator = ((IInfrastructure <IServiceProvider>)databaseFacade).Instance.GetService <IPluginMigrator>(); migrator.Migrate(plugin); }