Пример #1
0
        /// <summary>
        /// Constructor for the WinEightStorageOfflineContext
        /// </summary>
        /// <param name="schema">The WinEightStorageSchema that specifies the set of the collections for the c.</param>
        /// <param name="scopeName">The scope name used to identify the scope on the service.</param>
        /// <param name="cachePath">Path in isolated storage where the data will be stored.</param>
        /// <param name="uri">Uri of the scope.  Used to intialize the CacheController.</param>
        /// <remarks>
        /// If the Uri specified is different from the one that is stored in the cache path, the
        /// Load method will throw an InvalidOperationException.
        /// </remarks>
        public WinEightContext(OfflineSchema schema, string scopeName, string cachePath,
                               Uri uri)
        {
            if (schema == null)
            {
                throw new ArgumentNullException("OfflineSchema");
            }

            if (string.IsNullOrEmpty(scopeName))
            {
                throw new ArgumentNullException("scopeName");
            }

            if (string.IsNullOrEmpty(cachePath))
            {
                throw new ArgumentNullException("cachePath");
            }

            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            this.isDisposed     = false;
            this.schema         = schema;
            this.scopeUri       = uri;
            this.scopeName      = scopeName;
            this.cachePath      = cachePath;
            this.StorageHandler = new StorageHandler(schema, cachePath);
            this.saveSyncLock   = new AutoResetLock();
            this.CreateCacheController();
        }
Пример #2
0
        /// <summary>
        /// Constructor for the offline context which allows a symmetric encryption algorithm to be specified.
        /// </summary>
        /// <param name="schema">The schema that specifies the set of the collections for the context.</param>
        /// <param name="scopeName">The scope name used to identify the scope on the service.</param>
        /// <param name="cachePath">Path in isolated storage where the data will be stored.</param>
        /// <param name="uri">Uri of the scopeName.  Used to intialize the CacheController.</param>
        /// <param name="encryptionAlgorithm">The symmetric encryption algorithm to use for files on disk</param>
        /// <remarks>
        /// If the Uri specified is different from the one that is stored in the cache path, the
        /// Load method will throw an InvalidOperationException.
        /// </remarks>
        public IsolatedStorageOfflineContext(IsolatedStorageSchema schema, string scopeName, string cachePath,
                                             Uri uri, SymmetricAlgorithm encryptionAlgorithm)
        {
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }

            if (string.IsNullOrEmpty(scopeName))
            {
                throw new ArgumentNullException("scopeName");
            }

            if (string.IsNullOrEmpty(cachePath))
            {
                throw new ArgumentNullException("cachePath");
            }

            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            _isDisposed = false;

            _schema         = schema;
            _scopeUri       = uri;
            _scopeName      = scopeName;
            _cachePath      = cachePath;
            _storageHandler = new SQLiteStorageHandler(this, schema, cachePath, encryptionAlgorithm);
            _saveSyncLock   = new AutoResetLock();

            CreateCacheController();
        }
Пример #3
0
        /// <summary>
        /// Dispose internal references
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (!isDisposed)
            {
                if (disposing)
                {
                    if (StorageHandler != null)
                    {
                        StorageHandler.Dispose();
                        StorageHandler = null;
                    }

                    if (saveSyncLock != null)
                    {
                        saveSyncLock.Dispose();
                        saveSyncLock = null;
                    }
                }

                isDisposed = true;
            }
        }
Пример #4
0
 /// <summary>
 /// This method will take the lock passed in
 /// </summary>
 /// <param name="l"></param>
 public Locker(AutoResetLock l)
 {
     _lock = l;
     _lock.Lock();
 }
Пример #5
0
 /// <summary>
 /// This method will take the lock passed in
 /// </summary>
 /// <param name="l"></param>
 public Locker(AutoResetLock l)
 {
     _lock = l;
     _lock.Lock();
 }
        /// <summary>
        /// Constructor for the offline context which allows a symmetric encryption algorithm to be specified.
        /// </summary>
        /// <param name="schema">The schema that specifies the set of the collections for the context.</param>
        /// <param name="scopeName">The scope name used to identify the scope on the service.</param>
        /// <param name="cachePath">Path in isolated storage where the data will be stored.</param>
        /// <param name="uri">Uri of the scopeName.  Used to intialize the CacheController.</param>
        /// <param name="encryptionAlgorithm">The symmetric encryption algorithm to use for files on disk</param>
        /// <remarks>
        /// If the Uri specified is different from the one that is stored in the cache path, the
        /// Load method will throw an InvalidOperationException.
        /// </remarks>
        public IsolatedStorageOfflineContext(IsolatedStorageSchema schema, string scopeName, string cachePath,
            Uri uri, SymmetricAlgorithm encryptionAlgorithm)
        {
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }

            if (string.IsNullOrEmpty(scopeName))
            {
                throw new ArgumentNullException("scopeName");
            }

            if (string.IsNullOrEmpty(cachePath))
            {
                throw new ArgumentNullException("cachePath");
            }

            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            _isDisposed = false;

            _schema = schema;
            _scopeUri = uri;
            _scopeName = scopeName;
            _cachePath = cachePath;
            _storageHandler = new SQLiteStorageHandler(this, schema, cachePath, encryptionAlgorithm);
            _saveSyncLock = new AutoResetLock();
            
            CreateCacheController();
        }