rspec/rules/S3363/why-dotnet.adoc

9 lines
681 B
Plaintext
Raw Normal View History

== Why is this an issue?
Using temporal types as the primary key of a table is risky.
When these types are used as primary keys, it usually means that each new key is created with the use of `.Now` or `.UtcNow` properties from `DateTime` and `DateTimeOffset` classes.
In those cases, duplicate keys exceptions may occur in many ways:
* when entries are added consecutively by a machine with low-enough system clock resolution;
* when two different threads are inserting entries in close enough sequence for both to have the same time;
* when changes such as daylight saving time (DST) transitions occur, where values can be repeated the following hour (only for `DateTime` type);