Beispiel #1
0
        /// <summary>
        /// Constructor for CacheController
        /// </summary>
        /// <param name="serviceUri">Remote sync service Uri with a trailing "/" parameter.</param>
        /// <param name="scopeName">The scope name being synchronized</param>
        /// <param name="localProvider">The OfflineSyncProvider instance for the local store.</param>
        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;
        }
Beispiel #2
0
        /// <summary>
        /// Constructor for CacheController
        /// </summary>
        /// <param name="serviceUri">Remote sync service Uri with a trailing "/" parameter.</param>
        /// <param name="scopeName">The scope name being synchronized</param>
        /// <param name="localProvider">The OfflineSyncProvider instance for the local store.</param>
        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.CurrentCultureIgnoreCase) &&
                !serviceUri.Scheme.Equals("https", StringComparison.CurrentCultureIgnoreCase))
            {
                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;
        }
Beispiel #3
0
 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);
 }
        //       private SyncReader syncReader;
        //       private SyncWriter syncWriter;

        public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
        {
            baseUri             = serviceUri;
            serializationFormat = behaviors.SerializationFormat;
            scopeName           = behaviors.ScopeName;
            credentials         = behaviors.Credentials;
            knownTypes          = new Type[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(knownTypes, 0);
            scopeParameters = new Dictionary <string, string>(behaviors.ScopeParametersInternal);
        }
        //       private SyncReader syncReader;
        //       private SyncWriter syncWriter;

        public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
        {
            baseUri = serviceUri;
            serializationFormat = behaviors.SerializationFormat;
            scopeName = behaviors.ScopeName;
            credentials = behaviors.Credentials;
            knownTypes = new Type[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(knownTypes, 0);
            scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
        }
 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>();
 }
Beispiel #8
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;
        }
Beispiel #10
0
        //       private SyncReader syncReader;
        //       private SyncWriter syncWriter;

        public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
        {
            baseUri             = serviceUri;
            serializationFormat = behaviors.SerializationFormat;
            scopeName           = behaviors.ScopeName;
            credentials         = behaviors.Credentials;
            knownTypes          = new Type[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(knownTypes, 0);
            scopeParameters        = new Dictionary <string, string>(behaviors.ScopeParametersInternal);
            customHeaders          = new Dictionary <string, string>(behaviors.CustomHeadersInternal);
            automaticDecompression = behaviors.AutomaticDecompression;
            this.CookieContainer   = behaviors.CookieContainer;
        }
        //       private SyncReader syncReader;
        //       private SyncWriter syncWriter;

        public HttpCacheRequestHandler(Uri serviceUri, CacheControllerBehavior behaviors)
        {
            baseUri = serviceUri;
            serializationFormat = behaviors.SerializationFormat;
            scopeName = behaviors.ScopeName;
            credentials = behaviors.Credentials;
            knownTypes = new Type[behaviors.KnownTypes.Count];
            behaviors.KnownTypes.CopyTo(knownTypes, 0);
            scopeParameters = new Dictionary<string, string>(behaviors.ScopeParametersInternal);
            customHeaders = new Dictionary<string, string>(behaviors.CustomHeadersInternal);
            automaticDecompression = behaviors.AutomaticDecompression;
            this.CookieContainer = behaviors.CookieContainer;
        }
 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);
 }
Beispiel #15
0
 /// <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));
 }
		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);
			}
		}