Skip to content

Instantly share code, notes, and snippets.

@jujiro
Created May 20, 2019 16:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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