object _lockObject = new object(); // Object used for locking access to the cancelled flag public CacheController(Uri serviceUri, string scopeName, OfflineSyncProvider localProvider) { if (serviceUri == null) { throw new ArgumentNullException("serviceUri"); } if (string.IsNullOrEmpty(scopeName)) { throw new ArgumentNullException("scopeName"); } if (!serviceUri.Scheme.Equals("http", StringComparison.InvariantCultureIgnoreCase) && !serviceUri.Scheme.Equals("https", StringComparison.InvariantCultureIgnoreCase)) { throw new ArgumentException("Uri must be http or https schema", "serviceUri"); } if (localProvider == null) { throw new ArgumentNullException("localProvider"); } this._serviceUri = serviceUri; this._localProvider = localProvider; this._controllerBehavior = new CacheControllerBehavior(); this._controllerBehavior.ScopeName = scopeName; }
public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors) : base(serviceUri, behaviors.ScopeName) { this._credentials = behaviors.Credentials; this._beforeRequestHandler = behaviors.BeforeSendingRequest; this._afterResponseHandler = behaviors.AfterReceivingResponse; this._knownTypes = new Type[behaviors.KnownTypes.Count]; behaviors.KnownTypes.CopyTo(this._knownTypes, 0); this._scopeParameters = new Dictionary <string, string>(behaviors.ScopeParametersInternal); }
/// <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> /// <returns>A CacheRequestHandler object</returns> public static CacheRequestHandler CreateRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors) { // For labs its always Http return(new HttpCacheRequestHandler(serviceUri, behaviors)); }