예제 #1
0
        internal DataAccessContext(string mutexName, string databaseFilename)
        {
            if (!string.IsNullOrEmpty(mutexName))
            {
                _mutex = ExclusiveLock.CreateFileSystemLock(SqlCeDatabaseHelper <DicomStoreDataContext> .GetDatabaseFilePath(mutexName + databaseFilename));
                _mutex.Lock();
            }

            try
            {
                // initialize a connection and transaction
                _databaseFilename = databaseFilename;
                _connection       = CreateConnection();
                _transaction      = _connection.BeginTransaction(IsolationLevel.ReadCommitted);
                _context          = new DicomStoreDataContext(_connection);
                //_context.Log = Console.Out;
            }
            catch
            {
                _mutex.Unlock();
                _mutex.Dispose();
                _mutex = null;

                throw;
            }

            lock (_syncLock)
            {
                if (_staticConnection == null)
                {
                    // This is done for performance reasons.  It forces a connection to remain open while the
                    // the app domain is running, so that the database is kept in memory.
                    try
                    {
                        _staticConnection = CreateConnection();
                    }
                    catch (Exception ex)
                    {
                        Platform.Log(LogLevel.Debug, ex, "Failed to initialize static connection to data store database");
                    }
                }
            }
        }
예제 #2
0
		internal DataAccessContext(string mutexName, string databaseFilename)
		{
			if (!string.IsNullOrEmpty(mutexName))
			{
				_mutex = ExclusiveLock.CreateFileSystemLock(SqlCeDatabaseHelper<DicomStoreDataContext>.GetDatabaseFilePath(mutexName + databaseFilename));
				_mutex.Lock();
			}

			try
			{
				// initialize a connection and transaction
				_databaseFilename = databaseFilename;
				_connection = CreateConnection();
				_transaction = _connection.BeginTransaction(IsolationLevel.ReadCommitted);
				_context = new DicomStoreDataContext(_connection);
				//_context.Log = Console.Out;
			}
			catch
			{
				_mutex.Unlock();
				_mutex.Dispose();
				_mutex = null;

				throw;
			}

			lock (_syncLock)
			{
				if (_staticConnection == null)
				{
					// This is done for performance reasons.  It forces a connection to remain open while the 
					// the app domain is running, so that the database is kept in memory.
					try
					{
						_staticConnection = CreateConnection();
					}
					catch (Exception ex)
					{
						Platform.Log(LogLevel.Debug, ex, "Failed to initialize static connection to data store database");
					}
				}
			}
		}
예제 #3
0
		internal WorkItemUidBroker(DicomStoreDataContext context)
			: base(context) {}
예제 #4
0
 internal StudyBroker(DicomStoreDataContext context)
     : base(context)
 {
 }
예제 #5
0
        public DeviceBroker(DicomStoreDataContext context)
            : base(context)
		{
		}
예제 #6
0
		internal StudyBroker(DicomStoreDataContext context)
			: base(context)
		{
		}
예제 #7
0
 public DeviceBroker(DicomStoreDataContext context)
     : base(context)
 {
 }
 internal WorkItemUidBroker(DicomStoreDataContext context)
     : base(context)
 {
 }
예제 #9
0
 protected Broker(DicomStoreDataContext context)
 {
     Context = context;
 }