serilog-sinks-mssqlserver
serilog-sinks-mssqlserver copied to clipboard
Fix UTC handling for TimeStamp column with ConvertToUtc=true
This pull request addresses a bug related to timestamp handling in the MSSqlServer sink, ensuring that timestamps are correctly converted to UTC when the ConvertToUtc option is set. It also adds a corresponding unit test to verify this behavior.
Bugfix: Timestamp UTC conversion
- Updated
GetTimeStampStandardColumnNameAndValueinStandardColumnDataGenerator.csto useUtcDateTimefor the timestamp value whenConvertToUtcis enabled, ensuring correct UTC storage.
Testing improvements
- Added a unit test
GetStandardColumnNameAndValueForTimeStampCreatesUtcDateTimeUsingUtcDateTimePropertyinStandardColumnDataGeneratorTests.csto verify that the timestamp is converted to UTC and stored as aDateTimewithDateTimeKind.UtcwhenConvertToUtcis set.
Closes #659