Пример #1
0
 /// <summary>
 /// Main call to store values in the StorageService
 /// </summary>
 /// <typeparam name="T">Type of class to be stored</typeparam>
 /// <param name="MyValue">Dictionary of Values of the class to be stored</param>
 /// <param name="pCMD">Command for the store process</param>
 /// <param name="pMagicID">MagicID to be used for back-publish</param>
 /// <param name="pCallBack">If set, and the call came from a local service, the sevices calls back without using the communication system</param>
 public void EdgeDataStore <T>(Dictionary <string, T> MyValue, eSCMD pCMD, string pMagicID, Action <TSM> pCallBack, string pTableName)
 {
     if (TheCDEngines.MyIStorageService != null)
     {
         string serializedXML = TheStorageUtilities.SerializeDataToStore(MyValue, pMagicID, pCMD, typeof(T).Equals(typeof(cdeP)) ? null : pTableName);
         string post          = "CDE_EDGESTORE";
         post += ":";
         if (!string.IsNullOrEmpty(pMagicID) && pCallBack != null)
         {
             MyTimedCallbacks.AddAnItem(new TheTimedCallback()
             {
                 cdeMID = TheCommonUtils.CGuid(pMagicID), MyCallback = pCallBack
             });
             post += pMagicID;
         }
         if (typeof(T).Equals(typeof(cdeP)))
         {
             post += ":" + TheStorageUtilities.GenerateUniqueIDFromType(typeof(TheThing), pTableName);
         }
         TSM tTSM = new TSM(MyBaseEngine.GetEngineName(), post, serializedXML);
         if (TheCDEngines.MyIStorageService.GetBaseEngine().GetEngineState().IsService)
         {
             ProcessStorageServiceCommands(tTSM, pCallBack, true);
         }
         //else //Later for Remote Storage
         //{
         //    tTSM.SetToServiceOnly(true);
         //    TheCommCore.PublishCentral(tTSM);
         //}
     }
 }
Пример #2
0
        /// <summary>
        /// Stores the values of a class in the StorageServer
        /// </summary>
        /// <typeparam name="T">Type of the class to be stored</typeparam>
        /// <param name="pMyValue">Class with values to be stored</param>
        public void EdgeDataStoreOnly <T>(T pMyValue, string pTableName)
        {
            Dictionary <string, T> ToWriteOnly = new Dictionary <string, T>();
            TheDataBase            tDB         = pMyValue as TheDataBase;

            if (tDB != null)
            {
                tDB.cdeMID = Guid.NewGuid();
            }
            ToWriteOnly.Add(Guid.Empty.ToString(), pMyValue);
            eSCMD Cmd = eSCMD.Insert;

            EdgeDataStore(ToWriteOnly, Cmd, "", null, pTableName);
        }