public PostgresSharedSqlDataTypeProvider(ConstraintDefaults constraintDefaults, bool nativeUuids, bool nativeEnums)
            : base(constraintDefaults)
        {
            this.NativeUuids = nativeUuids;
            this.NativeEnums = nativeEnums;

            this.blobSqlDataType = new DefaultBlobSqlDataType(constraintDefaults, "BYTEA");

            DefineSqlDataType(typeof(bool), "BOOLEAN", "GetBoolean");
            DefineSqlDataType(typeof(short), "SMALLINT", "GetInt16");
            DefineSqlDataType(typeof(int), "INTEGER", "GetInt32");

            DefineSqlDataType(typeof(ushort), "SMALLINT", "GetUInt16");
            DefineSqlDataType(typeof(uint), "INTEGER", "GetUInt32");
            DefineSqlDataType(typeof(ulong), "BIGINT", "GetUInt64");

            DefineSqlDataType(typeof(double), "DOUBLE PRECISION", "GetDouble");
            DefineSqlDataType(typeof(byte), "SMALLINT", "GetByte");
            DefineSqlDataType(typeof(sbyte), "SMALLINT", "GetByte");
            DefineSqlDataType(typeof(decimal), "NUMERIC(57, 28)", "GetDecimal");

            DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaults, "TIMESTAMP", false));
            DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaults, "TIMESTAMP", true));

            DefineSqlDataType(new PostgresSharedTimespanSqlDataType(this.ConstraintDefaults, typeof(TimeSpan)));
            DefineSqlDataType(new PostgresSharedTimespanSqlDataType(this.ConstraintDefaults, typeof(TimeSpan?)));

            if (nativeUuids)
            {
                DefineSqlDataType(new PostgresSharedUuidSqlDataType(this.ConstraintDefaults, typeof(Guid)));
                DefineSqlDataType(new PostgresSharedUuidSqlDataType(this.ConstraintDefaults, typeof(Guid?)));
            }
        }
 protected internal void DefineSqlDataType(SqlDataType sqlDataType)
 {
     this.sqlDataTypesByType[sqlDataType.SupportedType] = sqlDataType;
 }
Ejemplo n.º 3
0
 protected void DefineSqlDataType(SqlDataType sqlDataType)
 {
     sqlDataTypesByType[sqlDataType.SupportedType] = sqlDataType;
 }
Ejemplo n.º 4
0
 protected void DefineSqlDataType(SqlDataType sqlDataType)
 {
     sqlDataTypesByType[sqlDataType.SupportedType] = sqlDataType;
 }