rspec/rules/S3363/introduction-dotnet.adoc

12 lines
852 B
Plaintext
Raw Normal View History

You should only set a property of a temporal type (like `DateTime` or `DateTimeOffset`) as the primary key of a table if the values are guaranteed to be unique.
The rule raises an issue if:
* Entity Framework, or Entity Framework Core dependencies are found;
* a class contains a property either named `Id`, `<type name>Id` or decorated by the `[Key]` or `[PrimaryKey]` attribute.
* the key property is of one of the following types:
** https://learn.microsoft.com/en-us/dotnet/api/system.datetime[System.DateTime]
** https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset[System.DateTimeOffset]
** https://learn.microsoft.com/en-us/dotnet/api/system.timespan[System.TimeSpan]
** https://learn.microsoft.com/en-us/dotnet/api/system.dateonly[System.DateOnly]
** https://learn.microsoft.com/en-us/dotnet/api/system.timeonly[System.TimeOnly]