示例#1
0
 public static void SaveProperties(SiteSettingsContext context, SiteSettingsPropertyValueCollection propertyValues)
 {
     Provider.SetPropertyValues(context, propertyValues);
 }
        public override void SetPropertyValues(SiteSettingsContext context, SiteSettingsPropertyValueCollection collection)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            //this.ExecuteQuery(
            //    query =>
            //        {
            //            const StringComparison mode = StringComparison.InvariantCultureIgnoreCase;

            //            var names = query.GetAllSettingNames();

            //            foreach (var item in collection.Where(prop => prop.IsDirty && !prop.Settings.ReadOnly))
            //            {
            //                var propertyName = item.Settings.PropertyName;
            //                var data = SerializeValue(item);

            //                if (names.Any(name => String.Equals(name, propertyName, mode)))
            //                {
            //                    query.UpdateSetting(propertyName, data);
            //                }
            //                else
            //                {
            //                    query.InsertSetting(propertyName, data);
            //                }
            //            }
            //        },
            //    true);

        }
示例#3
0
 public abstract void SetPropertyValues(SiteSettingsContext context, SiteSettingsPropertyValueCollection collection);
示例#4
0
        private void Initialize()
        {
            if (initialized)
            {
                return;
            }
            
            if (HostingEnvironment.IsHosted)
            {
                Host.CheckAspNetPermission(AspNetHostingPermissionLevel.Low, "");
            }

            lock (locker)
            {
                if (!initialized)
                {
                    try
                    {
                        var context = new SiteSettingsContext();
                        values = SiteSettings.GetPropertyValues(context, Properties);
                    }
                    finally
                    {
                        initialized = true;
                    }
                }
            }
        }