コード例 #1
0
        /// <summary>
        /// Create a synchronization context
        /// </summary>
        public static SynchronizationContext CreateContext()
        {
            try
            {
                Trace.TraceInformation("Create Synchrnoization Job Data");
                // Register
                using (var dao = new SyncData())
                {
                    // Sync context
                    var retVal = new SynchronizationContext()
                    {
                        JobId     = dao.CreateSynchronizationJob(Process.GetCurrentProcess().Id),
                        StartTime = DateTime.Now
                    };

                    Trace.TraceInformation("DB: Registered sync job id #{0}", retVal.JobId);
                    dao.Commit();
                    return(retVal);
                }
            }
            catch (Exception e)
            {
                Trace.TraceError(e.ToString());
                return(null);
            }
            finally
            {
            }
        }