This project is read-only.

Enable and Update feature programmatically

Nov 23, 2010 at 5:23 PM
Edited Nov 23, 2010 at 5:24 PM


I want to enable and then Update feature programmatically.

I do it this way in my controller


public void InstallFeatures(
IModuleService moduleService,
IDataMigrationManager dataMigrationManager,
IEnumerable<string> features) { foreach (var feature in features) { if (!dataMigrationManager.IsFeatureAlreadyInstalled(feature)) moduleService.EnableFeatures(new string[] { feature }); if (dataMigrationManager.GetFeaturesThatNeedUpdate().Contains(feature)) dataMigrationManager.Update(feature); } }

Features are being enabled but aren't updated. When the code is executed I see "Some features need to be upgraded...". DataMigrationManager does not see just enabled feature.

If I execute that code ones again it upgrades the feature.

Is there any way to make DataMigrationManager see just enabled features?

Thank you.