dotConnect for Snowflake Documentation
On this page
    Entity Framework Core Data Type Mapping
    On this page

    dotConnect for Snowflake supports Entity Framework Core 3.1, 8, 9, 10, and 11.

    Snowflake to .NET Type Mapping

    The following table shows the type mappings used when you generate a model from an existing schema by running Scaffold-DbContext in Package Manager Console or dotnet ef dbcontext scaffold in the .NET CLI.

    Snowflake Data Type

    Store Type in the Model

    .NET

    NUMBER(p, 0) (INT, INTEGER, BIGINT, SMALLINT, TINYINT, BYTEINT)NUMBER(p, 0)System.Int64 for p greater than 9 or not specified; System.Int32 for p from 5 to 9; System.Int16 for p = 3 or 4; System.Byte for p = 1 or 2
    NUMBER(p, s) with s greater than 0 (DECIMAL, NUMERIC)NUMBER(p, s)System.Decimal
    FLOAT (FLOAT4, FLOAT8, DOUBLE, DOUBLE PRECISION, REAL)FLOATSystem.Double
    BOOLEANBOOLEANSystem.Boolean
    VARCHAR (STRING, TEXT, CHAR, CHARACTER, NCHAR, NVARCHAR, NVARCHAR2, CHAR VARYING, NCHAR VARYING)VARCHAR, VARCHAR(n)System.String
    BINARY (VARBINARY)BINARY, BINARY(n)System.Byte[]
    DATEDATESystem.DateTime
    TIMETIMESystem.TimeSpan
    TIMESTAMP_NTZ (DATETIME, TIMESTAMP)TIMESTAMP_NTZSystem.DateTime
    TIMESTAMP_LTZTIMESTAMP_LTZSystem.DateTime
    TIMESTAMP_TZTIMESTAMP_TZSystem.DateTimeOffset
    VARIANTVARIANTSystem.String
    OBJECTOBJECTSystem.String
    ARRAYARRAYSystem.String
    GEOGRAPHYGEOGRAPHYSystem.String
    GEOMETRYGEOMETRYSystem.String

    .NET to Snowflake Type Mapping

    The following table shows the type mappings used when you create a database from a model through Code First, migrations, or EnsureCreated, and when you use parameters and literals in queries.

    .NET

    Snowflake Data Type

    System.Int64NUMBER(19, 0)
    System.Int32NUMBER(10, 0)
    System.Int16NUMBER(5, 0)
    System.Byte, System.SByteNUMBER(3, 0)
    System.Double, System.SingleFLOAT
    System.DecimalNUMBER(38, 10); NUMBER(p, s) if precision and scale are specified
    System.BooleanBOOLEAN
    System.StringVARCHAR; VARCHAR(n) if the maximum length is specified
    System.Byte[]BINARY; BINARY(n) if the maximum length is specified
    System.GuidVARCHAR(36) (the value is stored as text)
    System.DateTimeTIMESTAMP_NTZ
    System.DateTimeOffsetTIMESTAMP_TZ
    System.TimeSpanTIME
    System.DateOnly1DATE
    System.TimeOnly1TIME

    1 Entity Framework Core 8 and later.

    Notes