/// <summary> /// 取数据Setting /// </summary> /// <param name="doc"></param> /// <returns></returns> public TSetting GetSetting(Document doc) { if (_setting != null) { return(_setting); } _setting = new TSetting(); VLDelegateHelper.DelegateTryCatch( () => { string data = ExtensibleStorageHelper.GetData(doc, this, this.FieldOfSetting); _setting.LoadData(data); } ); return(_setting); }
/// <summary> /// 取数据Collection /// </summary> /// <param name="doc"></param> /// <returns></returns> public TCollection GetCollection(Document doc) { if (_collection != null) { return(_collection); } _collection = new TCollection(); VLDelegateHelper.DelegateTryCatch( () => { string data = ExtensibleStorageHelper.GetData(doc, this, this.FieldOfCollection); _collection.LoadData(data); } ); return(_collection); }
/// <summary> /// 保存Setting /// </summary> /// <param name="doc"></param> public void SaveSetting(Document doc, TSetting setting) { _setting = setting; var data = _setting.ToData(); VLDelegateHelper.DelegateTryCatch( () => { ExtensibleStorageHelper.SetData(doc, this, this.FieldOfSetting, data); }, () => { ExtensibleStorageHelper.RemoveStorage(doc, this); ExtensibleStorageHelper.SetData(doc, this, this.FieldOfSetting, data); } ); }
/// <summary> /// 保存Collection /// </summary> /// <param name="doc"></param> public void SaveCollection(Document doc, TCollection collection) { _collection = collection; var data = _collection.ToData(); VLDelegateHelper.DelegateTryCatch( () => { ExtensibleStorageHelper.SetData(doc, this, this.FieldOfCollection, data); }, () => { ExtensibleStorageHelper.RemoveStorage(doc, this); ExtensibleStorageHelper.SetData(doc, this, this.FieldOfCollection, data); } ); }