Ejemplo n.º 1
0
        public void Create(Setting setting)
        {
            var settingKey = new PartionKeyRowKeyPair(setting.Category, setting.Config);

            var settingRepository  = new SettingRepository(_tableEntityOperation);
            var settingTableEntity = new SettingTableEntity(settingKey, setting.Value);

            settingRepository.Create(settingTableEntity);
        }
Ejemplo n.º 2
0
        private static void CreateSettingIfNotExist(SettingRepository settingRepository,
                                                    SettingId settingId, string configurationSlot, string defaultValue)
        {
            //var settings = settingRepository.List(s => s.Category == settingId.Category && s.Config == settingId.Config);

            // EF7 workaround
            var settings =
                settingRepository.List(s => s.Category == settingId.Category)
                .Where(s => s.Config == settingId.Config)
                .ToList();

            if (settings.Count == 0)
            {
                var value = SettingReolver.Instance.Resolve(configurationSlot, defaultValue);

                var setting = new Setting(settingId, value);
                settingRepository.Create(setting);
                Console.WriteLine("Added {0}", settingId);
            }
        }