Understanding ORM basics
ORMs map relational DB tables into in-memory collections of objects where object properties correspond to DB table columns. Types from C#, such as Booleans, numeric types, and strings, have corresponding DB types. If GUIDs are not available in the mapped database, then types such as GUIDs are mapped to their equivalent string representations. All date and time types are mapped either to C# DateTime
when the date/time contains no time zone information, to DateTimeOffset
when the date/time also contains explicit time zone information, to DateOnly
(new in .NET 6) when the type contains just date information, or to TimeOnly
(new in .NET 6) when the type contains just time information. Any DB time duration is mapped to a TimeSpan
. Finally, single characters should not be mapped at all to DB fields.
Since the string properties of most object-oriented languages have no length limits associated with them (while DB string fields usually have length limits), the...