예제 #1
0
        async public Task UpdateMetadataProviders()
        {
            _providers = _providers ?? new ConcurrentBag <IMetadataProvider>();

            var metadataProviders = new PlugInManager().GetPluginInstances(typeof(IMetadataProvider)).ToArray();

            foreach (var metadataProvider in metadataProviders.Where(p => p is IMetadataProvider))
            {
                if (await((IMetadataProvider)metadataProvider).ApplyTo(this))
                {
                    if (_providers.Where(p => p.GetType().Equals(metadataProvider.GetType())).Count() == 0)
                    {
                        _providers.Add((IMetadataProvider)metadataProvider);
                    }
                }
            }
        }