Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sql data type mappings to some basic clr types
public class TypeMapping
{
public Dictionary<string, string> SqlToCSharpMappings = new Dictionary<string, string>()
{
{"BINARY","byte[]"},
{"BIGINT","long?"},
{"BIT","bool?"},
{"CHAR","string"},
{"DATETIME2","DateTime?"},
{"DECIMAL","decimal?"},
{"FLOAT","double?"},
{"IMAGE","byte[]"},
{"INT","int?"},
{"MONEY","decimal?"},
{"NCHAR","string"},
{"NTEXT","string"},
{"NUMERIC","decimal?"},
{"NVARCHAR","string"},
{"REAL","single"},
{"SMALLDATETIME","DateTime?"},
{"SMALLINT","Int16?"},
{"SMALLMONEY","decimal?"},
{"TEXT","string"},
{"TIME","TimeSpan?"},
{"TIMESTAMP","byte[]"},
{"TINYINT","byte?"},
{"UNIQUEIDENTIFIER","Guid?"},
{"VARBINARY","byte[]"},
{"VARCHAR","string"},
{"XML","string"}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment