Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataLogService" /> class.
        /// </summary>
        /// <param name="dataLogConnectionString">The <see cref="DataLogConnectionString" /> used to connect to the database.</param>
        /// <exception cref="ArgumentNullException"><paramref name="dataLogConnectionString" /> is null.</exception>
        public DataLogService(DataLogConnectionString dataLogConnectionString)
        {
            _dataLogConnectionString = dataLogConnectionString ?? throw new ArgumentNullException(nameof(dataLogConnectionString));
            _writer  = new DataLogDatabaseWriter(dataLogConnectionString);
            _cleanup = new DataLogCleanup(dataLogConnectionString);

            _cacheCheckTimer   = new Timer(RetryCacheEntries, null, Timeout.Infinite, Timeout.Infinite);
            _cleanupCheckTimer = new Timer(DeleteExpiredSessions, null, _cleanupCheckFrequency, _cleanupCheckFrequency);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLogService" /> class.
 /// </summary>
 /// <param name="dataLogConnectionString">The <see cref="DataLogConnectionString" /> used to connect to the database.</param>
 /// <param name="alternateConnectionString">A <see cref="DataLogConnectionString" /> used to connect to an alternate database if the primary operation fails.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="dataLogConnectionString" /> is null.
 /// <para>or</para>
 /// <paramref name="alternateConnectionString" /> is null.
 /// </exception>
 public DataLogService(DataLogConnectionString dataLogConnectionString, DataLogConnectionString alternateConnectionString)
     : this(dataLogConnectionString)
 {
     _alternateWriter = new DataLogDatabaseWriter(alternateConnectionString);
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLogCache" /> class.
 /// </summary>
 /// <param name="cacheLocation">The directory location to store cache files.</param>
 /// <param name="databaseWriter">The <see cref="DataLogDatabaseWriter" />.</param>
 /// <param name="alternateWriter">The alternate <see cref="DataLogDatabaseWriter" />.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="cacheLocation" /> is null.
 /// <para>or</para>
 /// <paramref name="databaseWriter" /> is null.
 /// <para>or</para>
 /// <paramref name="alternateWriter" /> is null.
 /// </exception>
 public DataLogCache(DirectoryInfo cacheLocation, DataLogDatabaseWriter databaseWriter, DataLogDatabaseWriter alternateWriter)
     : this(cacheLocation, databaseWriter)
 {
     _alternateWriter = alternateWriter ?? throw new ArgumentNullException(nameof(alternateWriter));
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLogCache" /> class.
 /// </summary>
 /// <param name="cacheLocation">The directory location to store cache files.</param>
 /// <param name="databaseWriter">The <see cref="DataLogDatabaseWriter" />.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="cacheLocation" /> is null.
 /// <para>or</para>
 /// <paramref name="databaseWriter" /> is null.
 /// </exception>
 public DataLogCache(DirectoryInfo cacheLocation, DataLogDatabaseWriter databaseWriter)
 {
     _cacheLocation  = cacheLocation ?? throw new ArgumentNullException(nameof(cacheLocation));
     _databaseWriter = databaseWriter ?? throw new ArgumentNullException(nameof(databaseWriter));
     _serializer     = new DataContractSerializer(typeof(DataLogCacheData));
 }