我正在使用 ABP 框架,并且想注册一个单例类以供全局使用。但它需要一些其他类。所以我想让 OnApplicationInitialization 函数注册它。
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var settingManager = context.ServiceProvider.GetService<ISettingManager>();
var cloudStorageProviderManager = context.ServiceProvider.GetService<ISlideCloudStorageProviderManager>();
var cloudProvider = await settingManager.GetOrNullGlobalAsync(CloudStorageSettings.CloudProvider);
var slideCloudStorage = cloudStorageProviderManager.Resolve(cloudProvider);
// how to register slideCloudStorage.
}