// Reset the state of the objects
 void ResetAsyncWorkerManager()
 {
     lock (this._lockObject)
     {
         this._asyncWorkManager          = null;
         this._refreshRequestWorker      = null;
         this._cacheRequestHandler       = null;
         this._controllerBehavior.Locked = false;
         this._beginSessionComplete      = false;
     }
 }
 public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
     : base(serviceUri, behaviors.SerializationFormat, behaviors.ScopeName)
 {
     this._credentials = behaviors.Credentials;
     this._beforeRequestHandler = behaviors.BeforeSendingRequest;
     this._afterResponseHandler = behaviors.AfterReceivingResponse;
     this._workerManager = manager;
     this._knownTypes = new Type[behaviors.KnownTypes.Count];
     behaviors.KnownTypes.CopyTo(this._knownTypes, 0);
     this._scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
     this._requestToArgsMapper = new Dictionary<int, AsyncArgsWrapper>();
 }
 public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
     : base(serviceUri, behaviors.SerializationFormat, behaviors.ScopeName)
 {
     this._credentials          = behaviors.Credentials;
     this._beforeRequestHandler = behaviors.BeforeSendingRequest;
     this._afterResponseHandler = behaviors.AfterReceivingResponse;
     this._workerManager        = manager;
     this._knownTypes           = new Type[behaviors.KnownTypes.Count];
     behaviors.KnownTypes.CopyTo(this._knownTypes, 0);
     this._scopeParameters     = new Dictionary <string, string>(behaviors.ScopeParametersInternal);
     this._requestToArgsMapper = new Dictionary <int, AsyncArgsWrapper>();
 }
Exemple #4
0
        public NSUrlCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
            : base(serviceUri, behaviors.SerializationFormat, behaviors.ScopeName)
        {
            _workerManager   = manager;
            _scopeParameters = new Dictionary <string, string> (behaviors.ScopeParametersInternal);
            _knownTypes      = new EntityType[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(this._knownTypes, 0);
            _lockObject = new object();

            _credentials = behaviors.Credentials;
            _behaviors   = behaviors;
        }
        public NSUrlCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
            : base(serviceUri, behaviors.SerializationFormat, behaviors.ScopeName)
        {
            _workerManager = manager;
            _scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
            _knownTypes = new EntityType[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(_knownTypes, 0);
            _lockObject = new object();

            _credentials = behaviors.Credentials;
            _behaviors = behaviors;
        }
 /// <summary>
 /// Instantiates a new AsyncWorkerManager object that will be used for the current sync session
 /// </summary>
 void StartAsyncWorkerManager()
 {
     if (this._asyncWorkManager == null)
     {
         lock (this._lockObject)
         {
             if (this._asyncWorkManager == null)
             {
                 this._asyncWorkManager          = new AsyncWorkerManager(OnRefreshCancelled);
                 this._controllerBehavior.Locked = true;
                 // Reset Cancelled flag
                 this.Cancelled = false;
             }
             else
             {
                 // This means two different threads raced and called RefreshAsync which wasnt caught by the IsBusy check
                 throw CacheControllerException.CreateCacheBusyException();
             }
         }
     }
 }
 CacheRequestHandler CacheRequestFactory(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
 {
     return new HttpCacheRequestHandler(serviceUri, behaviors, manager);
 }
 /// <summary>
 /// Factory method for creating a cache handler. For labs only Http based implementation is provided.
 /// </summary>
 /// <param name="serviceUri">Base Uri to connect to</param>
 /// <param name="behaviors">The CacheControllerBehavior object</param>
 /// <param name="manager">The AsyncWorkerManager object to use when issuning custom async operations.</param>
 /// <returns>A CacheRequestHandler object</returns>
 public static CacheRequestHandler CreateRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
 {
     // For labs its always Http
     return(new HttpCacheRequestHandler(serviceUri, behaviors, manager));
 }
 /// <summary>
 /// Factory method for creating a cache handler. For labs only Http based implementation is provided.
 /// </summary>
 /// <param name="serviceUri">Base Uri to connect to</param>
 /// <param name="behaviors">The CacheControllerBehavior object</param>
 /// <param name="manager">The AsyncWorkerManager object to use when issuning custom async operations.</param>
 /// <returns>A CacheRequestHandler object</returns>
 public static CacheRequestHandler CreateRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
 {
     // For labs its always Http
     return new HttpCacheRequestHandler(serviceUri, behaviors, manager);
 }
 // Reset the state of the objects
 void ResetAsyncWorkerManager()
 {
     lock (this._lockObject)
     {
         this._asyncWorkManager = null;
         this._refreshRequestWorker = null;
         this._cacheRequestHandler = null;
         this._controllerBehavior.Locked = false;
         this._beginSessionComplete = false;
     }
 }
 /// <summary>
 /// Instantiates a new AsyncWorkerManager object that will be used for the current sync session
 /// </summary>
 void StartAsyncWorkerManager()
 {
     if (this._asyncWorkManager == null)
     {
         lock (this._lockObject)
         {
             if (this._asyncWorkManager == null)
             {
                 this._asyncWorkManager = new AsyncWorkerManager(OnRefreshCancelled);
                 this._controllerBehavior.Locked = true;
                 // Reset Cancelled flag
                 this.Cancelled = false;
             }
             else
             {
                 // This means two different threads raced and called RefreshAsync which wasnt caught by the IsBusy check
                 throw CacheControllerException.CreateCacheBusyException();
             }
         }
     }
 }
		CacheRequestHandler CacheRequestFactory (Uri serviceUri, CacheControllerBehavior behaviors, AsyncWorkerManager manager)
		{
			if (OSVersion.Major < 7 || Settings.BackgoundLoadDisabled) {
				return new HttpCacheRequestHandler (serviceUri, behaviors, manager);
			} else {
				return new NSUrlCacheRequestHandler (serviceUri, behaviors, manager);
			}
		}