public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { PropertyDefine pd = new PropertyDefine(); pd.Name = DictionaryHelper.GetValue(dictionary, "name", string.Empty); pd.DisplayName = DictionaryHelper.GetValue(dictionary, "displayName", string.Empty); pd.Category = DictionaryHelper.GetValue(dictionary, "category", string.Empty); pd.DefaultValue = DictionaryHelper.GetValue(dictionary, "defaultValue", string.Empty); pd.DataType = DictionaryHelper.GetValue(dictionary, "dataType", PropertyDataType.String); pd.Description = DictionaryHelper.GetValue(dictionary, "description", string.Empty); pd.ReadOnly = DictionaryHelper.GetValue(dictionary, "readOnly", false); pd.Visible = DictionaryHelper.GetValue(dictionary, "visible", true); pd.EditorKey = DictionaryHelper.GetValue(dictionary, "editorKey", string.Empty); pd.PersisterKey = DictionaryHelper.GetValue(dictionary, "persisterKey", string.Empty); pd.EditorParamsSettingsKey = DictionaryHelper.GetValue(dictionary, "editorParamsSettingsKey", string.Empty); pd.EditorParams = DictionaryHelper.GetValue(dictionary, "editorParams", string.Empty); pd.SortOrder = DictionaryHelper.GetValue(dictionary, "sortOrder", 0xFFFF); pd.MaxLength = DictionaryHelper.GetValue(dictionary, "maxLength", 0xFFFF); pd.IsRequired = DictionaryHelper.GetValue(dictionary, "isRequired", false); pd.ShowTitle = DictionaryHelper.GetValue(dictionary, "showTitle", true); if (dictionary.ContainsKey("validators") == true) { PropertyValidatorDescriptorCollection validators = JSONSerializerExecute.Deserialize <PropertyValidatorDescriptorCollection>(dictionary["validators"]); pd.Validators.Clear(); pd.Validators.CopyFrom(validators); } PropertyValue pv = new PropertyValue(pd); pv.StringValue = DictionaryHelper.GetValue(dictionary, "value", (string)null); return(pv); }
public virtual void Deserialize(XElement node, XmlDeserializeContext context) { this.Name = node.Attribute("_n", this.Name); this.DisplayName = node.Attribute("_dn", this.DisplayName); this.Category = node.Attribute("_category", this.Category); this._DataType = node.Attribute("_dataType", PropertyDataType.String); this.DefaultValue = node.Attribute("_dv", this.DefaultValue); this.Description = node.Attribute("_desp", this.Description); this.EditorKey = node.Attribute("_eKey", this.EditorKey); this.PersisterKey = node.Attribute("_perKey", this.PersisterKey); this.EditorParamsSettingsKey = node.Attribute("_ePS", this.EditorParamsSettingsKey); this.EditorParams = node.Attribute("_eP", this.EditorParams); this.ReadOnly = node.Attribute("_ro", false); this.Visible = node.Attribute("_visible", true); this.AllowOverride = node.Attribute("_override", true); this.SortOrder = node.Attribute("_sortOrder", 0); this.MaxLength = node.Attribute("_ml", 0); this.IsRequired = node.Attribute("_isRequired", false); this.ShowTitle = node.Attribute("_showTitle", true); if (node.HasElements) { if (this._Validators == null) { this._Validators = new PropertyValidatorDescriptorCollection(); } else { this._Validators.Clear(); } this._Validators.Deserialize(node, context); } }
public void CopyFrom(PropertyValidatorDescriptorCollection list) { ExceptionHelper.FalseThrow <ArgumentNullException>(list != null, "list"); this.Clear(); foreach (PropertyValidatorDescriptor item in list) { this.Add(item); } }