Need to delay building of IRequiresRegistration until other parts are registered.

pull/702/head
Eric Reed 12 years ago
parent a7f06c84b1
commit a2ae2630bb

@ -47,6 +47,13 @@ namespace MediaBrowser.Common.Implementations.Security
private IJsonSerializer _jsonSerializer; private IJsonSerializer _jsonSerializer;
private IApplicationHost _appHost; private IApplicationHost _appHost;
private IEnumerable<IRequiresRegistration> _registeredEntities; private IEnumerable<IRequiresRegistration> _registeredEntities;
protected IEnumerable<IRequiresRegistration> RegisteredEntities
{
get
{
return _registeredEntities ?? (_registeredEntities = _appHost.GetExports<IRequiresRegistration>());
}
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="PluginSecurityManager" /> class. /// Initializes a new instance of the <see cref="PluginSecurityManager" /> class.
@ -61,7 +68,6 @@ namespace MediaBrowser.Common.Implementations.Security
_appHost = appHost; _appHost = appHost;
_httpClient = httpClient; _httpClient = httpClient;
_jsonSerializer = jsonSerializer; _jsonSerializer = jsonSerializer;
_registeredEntities = _appHost.GetExports<IRequiresRegistration>();
MBRegistration.Init(appPaths); MBRegistration.Init(appPaths);
} }
@ -74,7 +80,7 @@ namespace MediaBrowser.Common.Implementations.Security
var tasks = new List<Task>(); var tasks = new List<Task>();
ResetSupporterInfo(); ResetSupporterInfo();
tasks.AddRange(_registeredEntities.Select(i => i.LoadRegistrationInfoAsync())); tasks.AddRange(RegisteredEntities.Select(i => i.LoadRegistrationInfoAsync()));
await Task.WhenAll(tasks); await Task.WhenAll(tasks);
} }

Loading…
Cancel
Save