Example #1
0
        public void RegisterFeature(IFeature feature)
        {
            CheckAndConnect();

            if (this.ContainsKey(feature.Id))
            {
                throw new Exception(string.Format("Feature with key {0} is already registered", feature.Id));
            }

            FeatureRecord featureObject = new FeatureRecord(feature);

            AllFeatures.Insert(featureObject);

            Logger.Info("[{0}] has been registered successfully", featureObject);
        }
Example #2
0
        public void SaveFeature(IFeature feature)
        {
                        #if DEBUG
            Logger.Debug("[FeaturesStore]: Trying to save feature => [{0}]", feature);
                        #endif
            if (ContainsKey(feature.Id))
            {
                FeatureRecord record = AllFeatures.FindOne(f => f.FeatureKey == feature.Id);
                feature.Record.Id = record.Id;
                AllFeatures.Update(feature.Record);
            }
            else
            {
                AllFeatures.Insert(feature.Record);
            }

                        #if DEBUG
            Logger.Debug("[FeaturesStore]: Feature has been updated/inserted successfully");
                        #endif
        }