예제 #1
0
        public DataSet ServerProcess(DataSet ds)
        {
            if (ds == null)
            {
                throw new ArgumentNullException("ds");
            }

            string hash = DataSetDiskCache.ComputeHash(ds);

            var cachedDs = this.dataSetCache.Get(hash);

            if (cachedDs != null)
            {
                return(cachedDs);
            }

            else
            {
                var result = this.ServerProcessInternal(ds);

                if (FetchClimateRequestBuilder.IsProcessingSuccessful(result))
                {
                    this.dataSetCache.Add(result);
                }
                return(result);
            }
        }
예제 #2
0
        protected override DataSet ServerProcessInternal(DataSet ds)
        {
            if (serviceUri == "(local)")
            {
                return(LocalProcess(ds));
            }

            string hash = DataSetDiskCache.ComputeHash(ds);

            DataSet proxyDataSet = null;

            // Creating new DataSet at the service.
            // TODO: fix following:
            try
            {
                try
                {
                    proxyDataSet = ProxyDataSet.CreateProxySync(taskQueue, ServicePort, "msds:memory", false, 10 * 60 * 1000);
                }
                catch (CommunicationObjectFaultedException)
                {
                    //Connection to server closed.
                    //Recreate service port and try again.
                    if (proxyDataSet != null && !proxyDataSet.IsDisposed)
                    {
                        proxyDataSet.Dispose();
                    }
                    this._servicePort = null;
                    proxyDataSet      = ProxyDataSet.CreateProxySync(taskQueue, ServicePort, "msds:memory", false, 10 * 60 * 1000);
                }
                AutoResetEvent     completed   = new AutoResetEvent(false);
                OnCommittedHandler onCommitted = new OnCommittedHandler(completed, OnDataSetCommitted);
                proxyDataSet.Committed += onCommitted.Handler;

                proxyDataSet.IsAutocommitEnabled = false;
                FetchClimateRequestBuilder.CopyRequestedDataSet(ds, proxyDataSet, false);
                proxyDataSet.Metadata[Namings.metadataNameHash] = hash;
                proxyDataSet.Commit();

                if (proxyDataSet.HasChanges)
                {
                    proxyDataSet.Commit();
                }

                completed.WaitOne();
                proxyDataSet.IsAutocommitEnabled = true;
                return(proxyDataSet);
            }
            catch
            {
                if (proxyDataSet != null && !proxyDataSet.IsDisposed)
                {
                    proxyDataSet.Dispose();
                }
                throw;
            }
        }
예제 #3
0
 public ProcessingClientBase()
 {
     string appFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
     this.dataSetCache = new DataSetDiskCache(System.IO.Path.Combine(appFolder, CacheFolder));
 }
예제 #4
0
        public ProcessingClientBase()
        {
            string appFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            this.dataSetCache = new DataSetDiskCache(System.IO.Path.Combine(appFolder, CacheFolder));
        }