Skip to content

Commit 491791f

Browse files
ndcckadluba
authored andcommitted
Update README.md
Added example how to customize the standard columns.
1 parent e9c4cb3 commit 491791f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,17 @@ In addition to any special properties described below, each Standard Column also
446446

447447
### Id
448448

449-
The `Id` column is an optional table identity column. It defaults to the `int` data type but can also be configured as `bigint`. The `AllowNull` property is always `false`. If it is included in the table, it must be an auto-incrementing unique identity column and is automatically configured and auto-created as such.
449+
The `Id` column is an optional table identity column. It defaults to the `int` data type but can also be configured as `bigint`. Example how to change the data type to bigint:
450+
451+
```c#
452+
var colOptions = new Serilog.Sinks.MSSqlServer.ColumnOptions();
453+
colOptions.Id.DataType = System.Data.SqlDbType.BigInt;
454+
455+
Log.Logger = new LoggerConfiguration().WriteTo.MSSqlServer(columnOptions: colOptions)
456+
// ...
457+
```
458+
459+
The `AllowNull` property is always `false`. If it is included in the table, it must be an auto-incrementing unique identity column and is automatically configured and auto-created as such.
450460

451461
Previous versions of this sink assumed the `Id` column was _always_ present as an `int` identity primary key with a clustered index. Other configurations are possible and probably preferable, however this is still the default for backwards-compatibility reasons. Carefully consider your anticipated logging volume and query requirements. The default setting is not ideal in real-world scenarios since a clustered index is primarily of use when the key is used for sorting or range searches. This is rarely the case for the `Id` column.
452462

0 commit comments

Comments
 (0)