Understanding ORM basics
ORMs map relational DB tables into in-memory collections of objects where object properties correspond to DB table fields. 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 date/time contains no time zone information or to DateTimeOffset
when date/time also contains explicit time zone 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 DB limits are taken into account in the DB mapping configuration. In general, when the mapping between DB types and object-oriented language types needs...