コード例 #1
0
 /// <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);
 }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
        /// <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);
            }
                );
        }
コード例 #4
0
        /// <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);
            }
                );
        }