public GetAliasService(IRuntimeConfiguration configuration, IRedisDatabaseFactory redisDatabaseFactory, ILogger <GetAliasService> logger, TelemetryClient telemetryClient)
 {
     _configuration        = configuration;
     _redisDatabaseFactory = redisDatabaseFactory;
     _logger          = logger;
     _telemetryClient = telemetryClient;
 }
예제 #2
0
        public static TextToSpeechConfiguration GetTextToSpeechConfiguration(this IRuntimeConfiguration runtimeConfiguration)
        {
            if (textToSpeechConfiguration == null)
            {
                textToSpeechConfiguration = TextToSpeechConfiguration.LoadConfiguration();
            }

            return(textToSpeechConfiguration);
        }
 public RestResourceController(
     IDataProvider dataProvider,
     IRuntimeConfigurationProvider <IRuntimeConfiguration> runtimeConfigurationProvider,
     ILogger <RestResourceController <TResource> > logger,
     IOptions <SnoozleOptions> options)
 {
     _dataProvider         = dataProvider;
     _runtimeConfiguration = runtimeConfigurationProvider.GetRuntimeConfigurationForType(typeof(TResource));
     _logger  = logger;
     _options = options.Value;
 }
예제 #4
0
 public MigrationBatch(
     IEnumerable<IMigrationStep> migrations,
     IEnumerable<IMigrationMetadata> unidentifiedMigrations,
     IVersioning versioning,
     IRuntimeConfiguration configuration)
 {
     _migrations = migrations.ToList();
     _steps = new ReadOnlyCollection<IMigrationStepMetadata>(_migrations.Select(s => s.Metadata).ToList());
     _unidentifiedMigrations = new ReadOnlyCollection<IMigrationMetadata>(unidentifiedMigrations.ToList());
     _versioning = versioning;
     _configuration = configuration;
 }
예제 #5
0
 public MigrationBatch(
     IEnumerable <IMigrationStep> migrations,
     IEnumerable <IMigrationMetadata> unidentifiedMigrations,
     IVersioning versioning,
     IRuntimeConfiguration configuration)
 {
     _migrations             = migrations.ToList();
     _steps                  = new ReadOnlyCollection <IMigrationStepMetadata>(_migrations.Select(s => s.Metadata).ToList());
     _unidentifiedMigrations = new ReadOnlyCollection <IMigrationMetadata>(unidentifiedMigrations.ToList());
     _versioning             = versioning;
     _configuration          = configuration;
 }
예제 #6
0
        public void Execute(IRuntimeConfiguration configuration, IVersioning versioning)
        {
            if (versioning == null)
            {
                throw new ArgumentNullException("versioning");
            }

            DateTime start = DateTime.Now;

            long   timestamp = GetTimestamp();
            string tag       = GetTag();

            using (IDbConnection connection = configuration.OpenConnection())
            {
                Debug.Assert(connection.State == ConnectionState.Open);

                using (IDbTransaction transaction = configuration.ConnectionInfo.SupportsTransactions ? connection.BeginTransaction() : null)
                {
                    IDbCommandExecutor executor;
                    using ((executor = configuration.SqlDispatcher.CreateExecutor(string.Format(CultureInfo.InvariantCulture, "Migration.{0}.{1}", Metadata.ModuleName, timestamp))) as IDisposable)
                    {
                        try
                        {
                            Execute(configuration.ProviderInfo, connection, transaction, Metadata.Direction, executor);
                        }
                        catch
                        {
                            Log.Error("An non-recoverable error occurred in migration '{0}'{1}{2} while executing {3}.",
                                      timestamp,
                                      Metadata.ModuleName != MigrationExportAttribute.DefaultModuleName ? " in module '" + Metadata.ModuleName + "'" : string.Empty,
                                      tag,
                                      Metadata.Direction);
                            throw;
                        }

                        // update versioning
                        versioning.Update(Metadata, connection, transaction, executor);
                    }

                    if (transaction != null)
                    {
                        transaction.Commit();
                    }
                }
            }

            Log.Verbose(LogCategory.Performance, "Migration of module '{0}' to {1}{2} took {3}s",
                        Metadata.ModuleName,
                        timestamp,
                        tag,
                        (DateTime.Now - start).TotalSeconds);
        }
예제 #7
0
        public void Execute(IRuntimeConfiguration configuration, IVersioning versioning)
        {
            if (versioning == null) throw new ArgumentNullException("versioning");

            DateTime start = DateTime.Now;

            long timestamp = GetTimestamp();
            string tag = GetTag();
            using (IDbConnection connection = configuration.OpenConnection())
            {
                Debug.Assert(connection.State == ConnectionState.Open);

                using (IDbTransaction transaction = configuration.ConnectionInfo.SupportsTransactions ? connection.BeginTransaction() : null)
                {
                    IDbCommandExecutor executor;
                    using ((executor = configuration.SqlDispatcher.CreateExecutor(string.Format(CultureInfo.InvariantCulture, "Migration.{0}.{1}", Metadata.ModuleName, timestamp))) as IDisposable)
                    {
                        try
                        {
                            Execute(configuration.ProviderInfo, connection, transaction, Metadata.Direction, executor);
                        }
                        catch
                        {
                            Log.Error("An non-recoverable error occurred in migration '{0}'{1}{2} while executing {3}.",
                                timestamp,
                                Metadata.ModuleName != MigrationExportAttribute.DefaultModuleName ? " in module '" + Metadata.ModuleName + "'" : string.Empty,
                                tag,
                                Metadata.Direction);
                            throw;
                        }

                        // update versioning
                        versioning.Update(Metadata, connection, transaction, executor);
                    }

                    if (transaction != null)
                    {
                        transaction.Commit();
                    }
                }
            }

            Log.Verbose(LogCategory.Performance, "Migration of module '{0}' to {1}{2} took {3}s",
                Metadata.ModuleName,
                timestamp,
                tag,
                (DateTime.Now - start).TotalSeconds);
        }
예제 #8
0
        protected DbAlterer(string connectionString, DbPlatform dbPlatform, DbAltererOptions options)
        {
            if (connectionString == null)
            {
                throw new ArgumentNullException("connectionString");
            }
            if (dbPlatform == null)
            {
                throw new ArgumentNullException("dbPlatform");
            }
            if (connectionString == null)
            {
                throw new ArgumentNullException("connectionString");
            }

            Configuration = CreateRuntimeConfiguration(connectionString, dbPlatform, options);
        }
예제 #9
0
        internal Versioning(IRuntimeConfiguration configuration, TableName versioningTableName)
        {
            _configuration = configuration;
            _versioningTableName = versioningTableName;

            _versioningTableExists = new Lazy<bool>(() =>
            {
                int exists;
                using (IDbConnection connection = configuration.OpenConnection())
                {
                    IDbCommand command = connection.CreateCommand();
                    command.CommandTimeout = 0; // do not timeout; the client is responsible for not causing lock-outs
                    command.CommandText = configuration.ProviderInfo.Provider.ExistsTable(connection.Database, _versioningTableName);
                    Log.Verbose(LogCategory.Sql, command.CommandText);
                    exists = Convert.ToInt32(command.ExecuteScalar(), CultureInfo.InvariantCulture);
                }
                return exists != 0;
            });
        }
예제 #10
0
        internal Versioning(IRuntimeConfiguration configuration, TableName versioningTableName)
        {
            _configuration       = configuration;
            _versioningTableName = versioningTableName;

            _versioningTableExists = new Lazy <bool>(() =>
            {
                int exists;
                using (IDbConnection connection = configuration.OpenConnection())
                {
                    IDbCommand command     = connection.CreateCommand();
                    command.CommandTimeout = 0; // do not timeout; the client is responsible for not causing lock-outs
                    command.CommandText    = configuration.ProviderInfo.Provider.ExistsTable(connection.Database, _versioningTableName);
                    Log.Verbose(LogCategory.Sql, command.CommandText);
                    exists = Convert.ToInt32(command.ExecuteScalar(), CultureInfo.InvariantCulture);
                }
                return(exists != 0);
            });
        }
 public SqlConnectionFactory(IRuntimeConfiguration runtimeConfiguration)
 {
     _runtimeConfiguration = runtimeConfiguration;
 }
 public UnhandledExceptionMiddleware(IRuntimeConfiguration configuration)
 {
     _configuration = configuration;
 }
예제 #13
0
 public RuntimeConfigWrapper(IRuntimeConfiguration configuration)
 {
     Configuration = configuration;
 }
예제 #14
0
 public RedisDatabaseFactory(IRuntimeConfiguration runtimeConfiguration)
 {
     _runtimeConfiguration = runtimeConfiguration;
 }
 public ClassIAmTesting(IRuntimeConfiguration runtimeConfig)
 {
     _runtimeConfig = runtimeConfig;
 }
예제 #16
0
 public MigrationBatchPreparer(IMigrationImporter importer, IVersioning versioning, IRuntimeConfiguration configuration)
 {
     _importer      = importer;
     _versioning    = versioning;
     _configuration = configuration;
 }
예제 #17
0
 public LoadGeneratorService(IRuntimeConfiguration runtimeConfiguration)
 {
     _runtimeConfiguration = runtimeConfiguration;
 }
예제 #18
0
 public static IDbConnection OpenConnection(this IRuntimeConfiguration configuration)
 {
     return(configuration.ConnectionFactory.OpenConnection(configuration.ConnectionInfo));
 }
예제 #19
0
 public static void SetTextToSpeechConfiguration(this IRuntimeConfiguration runtimeConfiguration, TextToSpeechConfiguration ttsConfiguration)
 {
     textToSpeechConfiguration = ttsConfiguration;
 }
예제 #20
0
 public MigrationBatchPreparer(IMigrationImporter importer, IVersioning versioning, IRuntimeConfiguration configuration)
 {
     _importer = importer;
     _versioning = versioning;
     _configuration = configuration;
 }