Exemplo n.º 1
0
        private static MSSqlServerSinkOptions BuildSinkOptions(DbLoggingConfig dbLoggingConfig)
        {
            var batchPeriod = TimeSpan.FromSeconds(dbLoggingConfig.BatchPeriodSecs > 0 ? dbLoggingConfig.BatchPeriodSecs : 5);
            var schemaName  = dbLoggingConfig.SchemaName ?? "dbo";
            var sinkOptions = new MSSqlServerSinkOptions
            {
                TableName          = "Logs",
                SchemaName         = schemaName,
                AutoCreateSqlTable = false,
                BatchPostingLimit  = 1000,
                BatchPeriod        = batchPeriod
            };

            return(sinkOptions);
        }
Exemplo n.º 2
0
        private static string GetConnectionString(IConfiguration configuration, DbLoggingConfig dbLoggingConfig)
        {
            string connStr = null;

            if (!string.IsNullOrWhiteSpace(dbLoggingConfig.ConnectionStringName))
            {
                connStr = configuration.GetConnectionString(dbLoggingConfig.ConnectionStringName);
            }
            if (string.IsNullOrWhiteSpace(connStr))
            {
                connStr = dbLoggingConfig.ConnectionString;
            }

            return(connStr);
        }