Example #1
0
        public virtual void SaveSettings(MetadataDefinition settings)
        {
            if (settings.Id == 0)
            {
                Logger.Debug("Adding Metabase definition for {0}", settings.Name);
                _database.Insert(settings);
            }

            else
            {
                Logger.Debug("Updating Metabase definition for {0}", settings.Name);
                _database.Update(settings);
            }
        }
Example #2
0
        public virtual void Initialize(IList<MetadataBase> metabaseProviders)
        {
            Logger.Debug("Initializing metabases. Count {0}", metabaseProviders.Count);

            _metadataProviders = metabaseProviders;

            var currentNotifiers = All();

            foreach (var notificationProvider in metabaseProviders)
            {
                MetadataBase metadataProviderLocal = notificationProvider;
                if (!currentNotifiers.Exists(c => c.MetadataProviderType == metadataProviderLocal.GetType().ToString()))
                {
                    var settings = new MetadataDefinition
                                       {
                                           Enable = false,
                                           MetadataProviderType = metadataProviderLocal.GetType().ToString(),
                                           Name = metadataProviderLocal.Name
                                       };

                    SaveSettings(settings);
                }
            }
        }