Esempio n. 1
0
 /// <summary>
 ///     Construct a sink posting to the specified database.
 /// </summary>
 /// <param name="connectionString">Connection string to access the database.</param>
 /// <param name="tableName">Name of the table to store the data in.</param>
 /// <param name="schemaName">Name of the schema for the table to store the data in. The default is 'dbo'.</param>
 /// <param name="batchPostingLimit">The maximum number of events to post in a single batch.</param>
 /// <param name="period">The time to wait between checking for event batches.</param>
 /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
 /// <param name="autoCreateSqlTable">Create log table with the provided name on destination sql server.</param>
 /// <param name="columnOptions">Options that pertain to columns</param>
 public MSSqlServerSink(
     string connectionString,
     string tableName,
     int batchPostingLimit,
     TimeSpan period,
     IFormatProvider formatProvider,
     bool autoCreateSqlTable     = false,
     ColumnOptions columnOptions = null,
     string schemaName           = "dbo"
     )
     : base(batchPostingLimit, period)
 {
     _traits = new MSSqlServerSinkTraits(connectionString, tableName, schemaName, columnOptions, formatProvider, autoCreateSqlTable);
 }
Esempio n. 2
0
 /// <summary>
 ///     Construct a sink posting to the specified database.
 /// </summary>
 /// <param name="connectionString">Connection string to access the database.</param>
 /// <param name="tableName">Name of the table to store the data in.</param>
 /// <param name="schemaName">Name of the schema for the table to store the data in. The default is 'dbo'.</param>
 /// <param name="batchPostingLimit">The maximum number of events to post in a single batch.</param>
 /// <param name="period">The time to wait between checking for event batches.</param>
 /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
 /// <param name="autoCreateSqlTable">Create log table with the provided name on destination sql server.</param>
 /// <param name="columnOptions">Options that pertain to columns</param>
 /// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
 public MSSqlServerSink(
     string connectionString,
     string tableName,
     int batchPostingLimit,
     TimeSpan period,
     IFormatProvider formatProvider,
     bool autoCreateSqlTable          = false,
     ColumnOptions columnOptions      = null,
     string schemaName                = "dbo",
     ITextFormatter logEventFormatter = null)
     : base(batchPostingLimit, period)
 {
     columnOptions.FinalizeConfigurationForSinkConstructor();
     _traits = new MSSqlServerSinkTraits(connectionString, tableName, schemaName, columnOptions, formatProvider, autoCreateSqlTable, logEventFormatter);
 }
Esempio n. 3
0
        /// <summary>
        ///     Construct a sink posting to the specified database.
        /// </summary>
        /// <param name="connectionString">Connection string to access the database.</param>
        /// <param name="tableName">Name of the table to store the data in.</param>
        /// <param name="schemaName">Name of the schema for the table to store the data in. The default is 'dbo'.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="autoCreateSqlTable">Create log table with the provided name on destination sql server.</param>
        /// <param name="columnOptions">Options that pertain to columns</param>
        public MSSqlServerAuditSink(
            string connectionString,
            string tableName,
            IFormatProvider formatProvider,
            bool autoCreateSqlTable     = false,
            ColumnOptions columnOptions = null,
            string schemaName           = "dbo"
            )
        {
            if (columnOptions != null)
            {
                if (columnOptions.DisableTriggers)
                {
                    throw new NotSupportedException($"The {nameof(ColumnOptions.DisableTriggers)} option is not supported for auditing.");
                }
            }

            _traits = new MSSqlServerSinkTraits(connectionString, tableName, schemaName, columnOptions, formatProvider, autoCreateSqlTable);
        }
Esempio n. 4
0
        /// <summary>
        ///     Construct a sink posting to the specified database.
        /// </summary>
        /// <param name="connectionString">Connection string to access the database.</param>
        /// <param name="tableName">Name of the table to store the data in.</param>
        /// <param name="schemaName">Name of the schema for the table to store the data in. The default is 'dbo'.</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="autoCreateSqlTable">Create log table with the provided name on destination sql server.</param>
        /// <param name="columnOptions">Options that pertain to columns</param>
        /// <param name="logEventFormatter">Supplies custom formatter for the LogEvent column, or null</param>
        public MSSqlServerAuditSink(
            string connectionString,
            string tableName,
            IFormatProvider formatProvider,
            bool autoCreateSqlTable          = false,
            ColumnOptions columnOptions      = null,
            string schemaName                = "dbo",
            ITextFormatter logEventFormatter = null)
        {
            columnOptions.FinalizeConfigurationForSinkConstructor();

            if (columnOptions != null)
            {
                if (columnOptions.DisableTriggers)
                {
                    throw new NotSupportedException($"The {nameof(ColumnOptions.DisableTriggers)} option is not supported for auditing.");
                }
            }

            _traits = new MSSqlServerSinkTraits(connectionString, tableName, schemaName, columnOptions, formatProvider, autoCreateSqlTable, logEventFormatter);
        }
 /// <summary>
 /// Constructor. A reference to the parent Traits object is used so that JSON
 /// can serialize Standard Column values exactly the way they would be written
 /// to discrete SQL columns.
 /// </summary>
 public JsonLogEventFormatter(MSSqlServerSinkTraits parent)
 {
     traits = parent;
 }