Type Mapping
Maps a .NET CLR type, or a single property, to its exact equivalent database type.
Mapping a CLR type
TypeMapper.Map(typeof(DateTime), DbType.DateTime2);
Every property of that CLR type across every entity now maps to DateTime2 unless overridden at the property level.
Mapping a single property
public class Person
{
[TypeMap(DbType.DateTime2)]
public DateTime DateOfBirth { get; set; }
}
Provider-specific types
Each provider also exposes its own attribute for finer control — SqlDbTypeAttribute for SQL Server, MySqlDbTypeAttribute for MySQL, NpgsqlDbTypeAttribute for PostgreSQL, and SqliteTypeAttribute for SQLite — for cases the generic DbType enum can’t express precisely.