public SqlFixedDateDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, bool nullable, SqlDataTypeProvider sqlDataTypeProvider) : base(constraintDefaultsConfiguration, nullable ? typeof(FixedDate?) : typeof(FixedDate), false) { this.dateTimeDataType = sqlDataTypeProvider.GetSqlDataType(nullable ? typeof(DateTime?) : typeof(DateTime)); this.typeConverter = System.ComponentModel.TypeDescriptor.GetConverter(this.SupportedType); }
protected SqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type supportedType, bool isUserDefinedType) { this.constraintDefaultsConfiguration = constraintDefaultsConfiguration; this.SupportedType = supportedType; this.IsUserDefinedType = isUserDefinedType; this.UnderlyingType = Nullable.GetUnderlyingType(supportedType); }
public DefaultSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { this.sqlDataTypesByType = new Dictionary<Type, SqlDataType>(); this.DefineSqlDataType(typeof(bool), "TINYINT", "GetBoolean"); this.DefineSqlDataType(typeof(byte), "BYTE UNSIGNED ", "GetByte"); this.DefineSqlDataType(typeof(sbyte), "BYTE", "GetByte"); this.DefineSqlDataType(typeof(char), "CHAR", "GetChar"); this.DefineSqlDataType(typeof(int), "INT", "GetInt32"); this.DefineSqlDataType(typeof(uint), "INT UNSIGNED ", "GetUInt32"); this.DefineSqlDataType(typeof(short), "SMALLINT", "GetInt16"); this.DefineSqlDataType(typeof(ushort), "SMALLINT UNSIGNED ", "GetUInt16"); this.DefineSqlDataType(typeof(long), "BIGINT", "GetInt64"); this.DefineSqlDataType(typeof(ulong), "BIGINT UNSIGNED", "GetUInt64"); this.DefineSqlDataType(typeof(DateTime), "DATETIME", "GetDateTime"); this.DefineSqlDataType(typeof(float), "FLOAT", "GetFloat"); this.DefineSqlDataType(typeof(double), "DOUBLE", "GetDouble"); this.DefineSqlDataType(typeof(decimal), "NUMERIC", "GetDecimal"); this.DefineSqlDataType(new DefaultGuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid))); this.DefineSqlDataType(new DefaultGuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid?))); this.DefineSqlDataType(new DefaultTimeSpanSqlDataType(this, this.ConstraintDefaultsConfiguration, typeof(TimeSpan))); this.DefineSqlDataType(new DefaultTimeSpanSqlDataType(this, this.ConstraintDefaultsConfiguration, typeof(TimeSpan?))); this.DefineSqlDataType(new DefaultStringSqlDataType(this.ConstraintDefaultsConfiguration)); }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { var sizeConstraintAttribute = propertyDescriptor?.PropertyInfo.GetFirstCustomAttribute<SizeConstraintAttribute>(true); if (sizeConstraintAttribute != null || constraintDefaults?.StringSizeFlexibility != null) { switch ((constraintDefaults?.StringSizeFlexibility ?? sizeConstraintAttribute.SizeFlexibility)) { case SizeFlexibility.Fixed: return CreateFixedTypeName(sizeConstraintAttribute.MaximumLength); case SizeFlexibility.Variable: return CreateVariableName(sizeConstraintAttribute.MaximumLength); case SizeFlexibility.LargeVariable: return CreateTextName(); default: throw new NotSupportedException("SizeFlexibility: " + sizeConstraintAttribute.SizeFlexibility); } } else { if (propertyDescriptor != null && (propertyDescriptor.IsPrimaryKey || propertyDescriptor.HasUniqueAttribute || propertyDescriptor.IndexAttributes.Count > 0)) { return this.CreateVariableName(this.constraintDefaultsConfiguration.IndexedStringMaximumLength); } else { return this.CreateVariableName((constraintDefaults ?? this.constraintDefaultsConfiguration).StringMaximumLength); } } }
public DefaultSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { this.sqlDataTypesByType = new Dictionary <Type, SqlDataType>(); this.DefinePrimitiveSqlDataType(typeof(bool), "TINYINT", "GetBoolean"); this.DefinePrimitiveSqlDataType(typeof(byte), "BYTE UNSIGNED ", "GetInt32"); this.DefinePrimitiveSqlDataType(typeof(sbyte), "BYTE", "GetByte"); this.DefinePrimitiveSqlDataType(typeof(char), "CHAR", "GetChar"); this.DefinePrimitiveSqlDataType(typeof(int), "INT", "GetInt32"); this.DefinePrimitiveSqlDataType(typeof(uint), "INT UNSIGNED ", "GetInt64"); this.DefinePrimitiveSqlDataType(typeof(short), "SMALLINT", "GetInt16"); this.DefinePrimitiveSqlDataType(typeof(ushort), "SMALLINT UNSIGNED ", "GetInt32"); this.DefinePrimitiveSqlDataType(typeof(long), "BIGINT", "GetInt64"); this.DefinePrimitiveSqlDataType(typeof(ulong), "BIGINT UNSIGNED", "GetValue"); this.DefinePrimitiveSqlDataType(typeof(DateTime), "DATETIME", "GetDateTime"); this.DefinePrimitiveSqlDataType(typeof(float), "FLOAT", "GetFloat"); this.DefinePrimitiveSqlDataType(typeof(double), "DOUBLE", "GetDouble"); this.DefinePrimitiveSqlDataType(typeof(decimal), "NUMERIC", "GetDecimal"); this.DefineSqlDataType(new DefaultGuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid))); this.DefineSqlDataType(new DefaultGuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid?))); this.DefineSqlDataType(new DefaultTimeSpanSqlDataType(this, this.ConstraintDefaultsConfiguration, typeof(TimeSpan))); this.DefineSqlDataType(new DefaultTimeSpanSqlDataType(this, this.ConstraintDefaultsConfiguration, typeof(TimeSpan?))); this.DefineSqlDataType(new DefaultStringSqlDataType(this.ConstraintDefaultsConfiguration)); }
public SqlServerSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { DefinePrimitiveSqlDataType(typeof(bool), "BIT", "GetValue"); DefinePrimitiveSqlDataType(typeof(byte), "TINYINT", "GetByte"); DefinePrimitiveSqlDataType(typeof(sbyte), "TINYINT", "GetByte"); DefinePrimitiveSqlDataType(typeof(char), "CHAR", "GetValue"); DefinePrimitiveSqlDataType(typeof(int), "INT", "GetInt32"); DefinePrimitiveSqlDataType(typeof(uint), "NUMERIC(10)", "GetValue"); DefinePrimitiveSqlDataType(typeof(short), "SMALLINT", "GetInt16"); DefinePrimitiveSqlDataType(typeof(ushort), "NUMERIC(5)", "GetValue"); DefinePrimitiveSqlDataType(typeof(long), "BIGINT", "GetInt64"); DefinePrimitiveSqlDataType(typeof(ulong), "NUMERIC(20)", "GetValue"); DefinePrimitiveSqlDataType(typeof(float), "FLOAT(24)", "GetValue"); DefinePrimitiveSqlDataType(typeof(double), "FLOAT(53)", "GetValue"); // TODO: Always use GetDateTime when Mono switches to using reference source implementation DefineSqlDataType(new DateTimeKindNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME2", false, DateTimeKind.Utc, SqlServerSqlDatabaseContext.IsRunningMono() ? DataRecordMethods.GetMethod(nameof(IDataRecord.GetValue)) : DataRecordMethods.GetMethod(nameof(IDataRecord.GetDateTime)))); DefineSqlDataType(new DateTimeKindNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME2", true, DateTimeKind.Utc, SqlServerSqlDatabaseContext.IsRunningMono() ? DataRecordMethods.GetMethod(nameof(IDataRecord.GetValue)) : DataRecordMethods.GetMethod(nameof(IDataRecord.GetDateTime)))); DefineSqlDataType(new SqlServerDecimalDataType(constraintDefaultsConfiguration, typeof(decimal), "DECIMAL(38, 9)")); DefineSqlDataType(new SqlServerDecimalDataType(constraintDefaultsConfiguration, typeof(decimal?), "DECIMAL(38, 9)")); DefineSqlDataType(new DefaultBlobSqlDataType(constraintDefaultsConfiguration, "VARBINARY(MAX)")); DefineSqlDataType(new SqlServerStringSqlDataType(constraintDefaultsConfiguration)); }
public PostgresSqlDataTypeProvider(TypeDescriptorProvider typeDescriptorProvider, ConstraintDefaultsConfiguration constraintDefaultsConfiguration, bool nativeUuids, bool nativeEnums) : base(constraintDefaultsConfiguration) { this.typeDescriptorProvider = typeDescriptorProvider; this.NativeUuids = nativeUuids; this.NativeEnums = nativeEnums; this.blobSqlDataType = new DefaultBlobSqlDataType(constraintDefaultsConfiguration, "BYTEA"); this.DefineSqlDataType(typeof(bool), "BOOLEAN", "GetBoolean"); this.DefineSqlDataType(typeof(short), "SMALLINT", "GetInt16"); this.DefineSqlDataType(typeof(int), "INTEGER", "GetInt32"); this.DefineSqlDataType(typeof(ushort), "SMALLINT", "GetUInt16"); this.DefineSqlDataType(typeof(uint), "INTEGER", "GetUInt32"); this.DefineSqlDataType(typeof(ulong), "BIGINT", "GetUInt64"); this.DefineSqlDataType(typeof(double), "DOUBLE PRECISION", "GetDouble"); this.DefineSqlDataType(typeof(byte), "SMALLINT", "GetByte"); this.DefineSqlDataType(typeof(sbyte), "SMALLINT", "GetByte"); this.DefineSqlDataType(typeof(decimal), "NUMERIC(57, 28)", "GetDecimal"); this.DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "TIMESTAMP", false)); this.DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "TIMESTAMP", true)); this.DefineSqlDataType(new PostgresTimespanSqlDataType(this.ConstraintDefaultsConfiguration, typeof(TimeSpan))); this.DefineSqlDataType(new PostgresTimespanSqlDataType(this.ConstraintDefaultsConfiguration, typeof(TimeSpan?))); if (nativeUuids) { this.DefineSqlDataType(new PostgresUuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid))); this.DefineSqlDataType(new PostgresUuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid?))); } }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { var sizeConstraintAttribute = propertyDescriptor?.PropertyInfo.GetFirstCustomAttribute <SizeConstraintAttribute>(true); if (sizeConstraintAttribute != null || constraintDefaults?.StringSizeFlexibility != null) { switch ((constraintDefaults?.StringSizeFlexibility ?? sizeConstraintAttribute.SizeFlexibility)) { case SizeFlexibility.Fixed: return(this.CreateFixedTypeName(sizeConstraintAttribute.MaximumLength)); case SizeFlexibility.Variable: return(this.CreateVariableName(sizeConstraintAttribute.MaximumLength)); case SizeFlexibility.LargeVariable: return(this.CreateTextName()); default: throw new NotSupportedException("SizeFlexibility: " + sizeConstraintAttribute.SizeFlexibility); } } else { if (propertyDescriptor != null && (propertyDescriptor.IsPrimaryKey || propertyDescriptor.HasUniqueAttribute || propertyDescriptor.IndexAttributes.Count > 0)) { return(this.CreateVariableName(this.constraintDefaultsConfiguration.IndexedStringMaximumLength)); } else { return(this.CreateVariableName((constraintDefaults ?? this.constraintDefaultsConfiguration).StringMaximumLength)); } } }
public InjectionContext(DataAccessModel model, SqlDatabaseContextInfo contextInfo, Func <SqlDataTypeProvider> defaultProviderFactoryMethod, Func <string, Tuple <bool, object> > parameterNameToValue = null) { this.model = model; this.contextInfo = contextInfo; this.defaultProviderFactoryMethod = defaultProviderFactoryMethod; this.parameterNameToValue = parameterNameToValue; this.typeDescriptorProvider = this.model.TypeDescriptorProvider; this.constraintsDefaultConfiguration = this.model.Configuration.ConstraintDefaultsConfiguration; }
public MySqlSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { this.DefineSqlDataType(typeof(byte), "TINYINT UNSIGNED", "GetByte"); this.DefineSqlDataType(typeof(sbyte), "TINYINT", "GetByte"); this.DefineSqlDataType(typeof(decimal), "DECIMAL(60, 30)", "GetDecimal"); this.DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME", false)); this.DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME", true)); }
public MySqlSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { DefinePrimitiveSqlDataType(typeof(byte), "TINYINT UNSIGNED", "GetByte"); DefinePrimitiveSqlDataType(typeof(sbyte), "TINYINT", "GetByte"); DefinePrimitiveSqlDataType(typeof(decimal), "DECIMAL(60, 30)", "GetDecimal"); DefineSqlDataType(new DateTimeKindNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME", false, DateTimeKind.Utc)); DefineSqlDataType(new DateTimeKindNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME", true, DateTimeKind.Utc)); }
private static ConstraintDefaultsConfiguration CreateConstraintDefaults(ConstraintDefaultsConfiguration defaultsConfiguration, Type type) { var length = GetRecommendedLength(type); return(new ConstraintDefaultsConfiguration(defaultsConfiguration) { StringMaximumLength = length, IndexedStringMaximumLength = length, StringSizeFlexibility = SizeFlexibility.Variable }); }
private static ConstraintDefaultsConfiguration CreateConstraintDefaults(ConstraintDefaultsConfiguration defaultsConfiguration, Type type) { var length = GetRecommendedLength(defaultsConfiguration, type); var attribute = type.GetUnwrappedNullableType().GetFirstCustomAttribute <SizeConstraintAttribute>(true); return(new ConstraintDefaultsConfiguration(defaultsConfiguration) { StringMaximumLength = attribute?.MaximumLength > 0 ? attribute.MaximumLength : length, IndexedStringMaximumLength = attribute?.MaximumLength > 0 ? attribute.MaximumLength : length, StringSizeFlexibility = attribute?.SizeFlexibility ?? SizeFlexibility.Variable }); }
public SqliteSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { this.DefineSqlDataType(typeof(byte), "INTEGER", "GetByte"); this.DefineSqlDataType(typeof(sbyte), "INTEGER", "GetByte"); this.DefineSqlDataType(typeof(char), "TEXT", "GetChar"); this.DefineSqlDataType(typeof(int), "INTEGER", "GetInt32"); this.DefineSqlDataType(typeof(uint), "INTEGER", "GetInt32"); this.DefineSqlDataType(typeof(short), "INTEGER", "GetInt16"); this.DefineSqlDataType(typeof(ushort), "INTEGER", "GetUInt16"); this.DefineSqlDataType(typeof(long), "INTEGER", "GetInt64"); this.DefineSqlDataType(typeof(ulong), "INTEGER BIGINT", "GetUInt64"); this.DefineSqlDataType(typeof(DateTime), "TEXT", "GetDateTime"); this.DefineSqlDataType(typeof(float), "REAL", "GetFloat"); this.DefineSqlDataType(typeof(double), "REAL", "GetDouble"); this.DefineSqlDataType(typeof(decimal), "TEXT", "GetDecimal"); }
public SqliteSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { DefinePrimitiveSqlDataType(typeof(byte), "INTEGER", "GetByte"); DefinePrimitiveSqlDataType(typeof(sbyte), "INTEGER", "GetByte"); DefinePrimitiveSqlDataType(typeof(char), "TEXT", "GetChar"); DefinePrimitiveSqlDataType(typeof(int), "INTEGER", "GetInt32"); DefinePrimitiveSqlDataType(typeof(uint), "INTEGER", "GetInt64"); DefinePrimitiveSqlDataType(typeof(short), "INTEGER", "GetInt16"); DefinePrimitiveSqlDataType(typeof(ushort), "INTEGER", "GetInt32"); DefinePrimitiveSqlDataType(typeof(long), "INTEGER", "GetInt64"); DefinePrimitiveSqlDataType(typeof(ulong), "INTEGER BIGINT", "GetValue"); DefinePrimitiveSqlDataType(typeof(DateTime), "TEXT", "GetDateTime"); DefinePrimitiveSqlDataType(typeof(float), "REAL", "GetValue"); DefinePrimitiveSqlDataType(typeof(double), "REAL", "GetValue"); DefinePrimitiveSqlDataType(typeof(decimal), "TEXT", "GetValue"); }
private static int GetRecommendedLength(ConstraintDefaultsConfiguration defaultsConfiguration, Type enumType) { var type = Nullable.GetUnderlyingType(enumType) ?? enumType; var names = Enum.GetNames(type); if (names.Length == 0) { return(defaultsConfiguration.StringMaximumLength); } var maximumSize = names.Max(c => c.Length); maximumSize = ((maximumSize / 16) + 1) * 16 + 8; if (type.GetFirstCustomAttribute <FlagsAttribute>(true) != null) { maximumSize = (maximumSize + 1) * names.Length; } return(maximumSize); }
public SqlServerSqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration) { this.DefineSqlDataType(typeof(bool), "BIT", "GetBoolean"); this.DefineSqlDataType(typeof(byte), "TINYINT", "GetByte"); this.DefineSqlDataType(typeof(sbyte), "TINYINT", "GetByte"); this.DefineSqlDataType(typeof(char), "CHAR", "GetChar"); this.DefineSqlDataType(typeof(int), "INT", "GetInt32"); this.DefineSqlDataType(typeof(uint), "NUMERIC(10)", "GetUInt32"); this.DefineSqlDataType(typeof(short), "SMALLINT", "GetInt16"); this.DefineSqlDataType(typeof(ushort), "NUMERIC(5)", "GetUInt16"); this.DefineSqlDataType(typeof(long), "BIGINT", "GetInt64"); this.DefineSqlDataType(typeof(ulong), "NUMERIC(20)", "GetUInt64"); this.DefineSqlDataType(typeof(float), "FLOAT(24)", "GetFloat"); this.DefineSqlDataType(typeof(double), "FLOAT(53)", "GetDouble"); this.DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME2", false)); this.DefineSqlDataType(new UniversalTimeNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "DATETIME2", true)); this.DefineSqlDataType(new SqlServerDecimalDataType(constraintDefaultsConfiguration, typeof(decimal), "DECIMAL(38, 9)")); this.DefineSqlDataType(new SqlServerDecimalDataType(constraintDefaultsConfiguration, typeof(decimal?), "DECIMAL(38, 9)")); this.DefineSqlDataType(new DefaultBlobSqlDataType(constraintDefaultsConfiguration, "VARBINARY(MAX)")); this.DefineSqlDataType(new SqlServerStringSqlDataType(constraintDefaultsConfiguration)); }
public PrimitiveSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type type, string sqlName, MethodInfo getMethod) : base(constraintDefaultsConfiguration, type) { this.SqlName = sqlName; this.GetMethod = getMethod; }
public DefaultBlobSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, string sqlName) : base(constraintDefaultsConfiguration, typeof(byte[])) { this.sqlName = sqlName; }
public PostgresDotConnectTimespanSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type supportedType) : base(constraintDefaultsConfiguration, supportedType) { }
public DefaultStringEnumSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(CreateConstraintDefaults(constraintDefaultsConfiguration, typeof(T)), typeof(T)) { }
public SqlServerDecimalDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type type, string sqlName) : base(constraintDefaultsConfiguration, type) { this.SqlName = sqlName; this.method = this.GetType().GetMethod("Read", BindingFlags.Public | BindingFlags.Static); }
public DefaultTimeSpanSqlDataType(SqlDataTypeProvider sqlDataTypeProvider, ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type type) : base(constraintDefaultsConfiguration, type) { this.sqlDataTypeProvider = sqlDataTypeProvider; }
public PostgresEnumSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type supportedType, TypeDescriptorProvider typeDescriptorProvider) : base(constraintDefaultsConfiguration, supportedType, true) { this.typeDescriptorProvider = typeDescriptorProvider; this.underlyingType = Nullable.GetUnderlyingType(supportedType); }
protected SqlDataTypeProvider(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) { this.ConstraintDefaultsConfiguration = constraintDefaultsConfiguration; }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { return this.sqlDataTypeProvider.GetSqlDataType(typeof(long)).GetSqlName(propertyDescriptor); }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { return "INTERVAL"; }
public PostgresTimespanSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type supportedType) : base(constraintDefaultsConfiguration, supportedType) { this.underlyingType = Nullable.GetUnderlyingType(supportedType); }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { var enumTypeDescriptor = this.typeDescriptorProvider.GetEnumTypeDescriptor(this.underlyingType ?? this.SupportedType); return enumTypeDescriptor.Name; }
public UniversalTimeNormalisingDateTimeSqlDateType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, string typeName, bool nullable) : base(constraintDefaultsConfiguration, nullable ? typeof(DateTime?) : typeof(DateTime), typeName, DataRecordMethods.GetMethod("GetDateTime")) { this.specifyKindMethod = nullable ? SpecifyKindIfUnspecifiedMethodNullable : SpecifyKindIfUnspecifiedMethod; }
/// <summary> /// Gets the SQL type name for the given property. /// </summary> /// <returns>The SQL type name</returns> public abstract string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults);
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { var enumTypeDescriptor = this.typeDescriptorProvider.GetEnumTypeDescriptor(this.underlyingType ?? this.SupportedType); return(enumTypeDescriptor.Name); }
protected SqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type supportedType) : this(constraintDefaultsConfiguration, supportedType, false) { }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { return(this.sqlDataTypeProvider.GetSqlDataType(typeof(long)).GetSqlName(propertyDescriptor)); }
public DefaultGuidSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type type) : base(constraintDefaultsConfiguration, type) { }
public SqlServerStringSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type type) : base(constraintDefaultsConfiguration, type) { }
public PostgresUuidSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type type) : base(constraintDefaultsConfiguration, type) { }
protected DefaultStringSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type type) : base(constraintDefaultsConfiguration, type) { }
public PostgresSqlDataTypeProvider(TypeDescriptorProvider typeDescriptorProvider, ConstraintDefaultsConfiguration constraintDefaultsConfiguration, bool nativeUuids, bool nativeEnums) : base(constraintDefaultsConfiguration) { this.typeDescriptorProvider = typeDescriptorProvider; this.NativeUuids = nativeUuids; this.NativeEnums = nativeEnums; this.blobSqlDataType = new DefaultBlobSqlDataType(constraintDefaultsConfiguration, "BYTEA"); DefinePrimitiveSqlDataType(typeof(bool), "BOOLEAN", "GetBoolean"); DefinePrimitiveSqlDataType(typeof(short), "SMALLINT", "GetInt16"); DefinePrimitiveSqlDataType(typeof(int), "INTEGER", "GetInt32"); DefinePrimitiveSqlDataType(typeof(ushort), "SMALLINT", "GetInt32"); DefinePrimitiveSqlDataType(typeof(uint), "INTEGER", "GetInt64"); DefinePrimitiveSqlDataType(typeof(ulong), "BIGINT", "GetValue"); DefinePrimitiveSqlDataType(typeof(float), "FLOAT(8)", "GetFloat"); DefinePrimitiveSqlDataType(typeof(double), "DOUBLE PRECISION", "GetDouble"); DefinePrimitiveSqlDataType(typeof(byte), "SMALLINT", "GetByte"); DefinePrimitiveSqlDataType(typeof(sbyte), "SMALLINT", "GetByte"); DefinePrimitiveSqlDataType(typeof(decimal), "NUMERIC(57, 28)", "GetDecimal"); DefineSqlDataType(new DateTimeKindNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "TIMESTAMP", false, DateTimeKind.Utc)); DefineSqlDataType(new DateTimeKindNormalisingDateTimeSqlDateType(this.ConstraintDefaultsConfiguration, "TIMESTAMP", true, DateTimeKind.Utc)); DefineSqlDataType(new PostgresTimespanSqlDataType(this.ConstraintDefaultsConfiguration, typeof(TimeSpan))); DefineSqlDataType(new PostgresTimespanSqlDataType(this.ConstraintDefaultsConfiguration, typeof(TimeSpan?))); if (nativeUuids) { DefineSqlDataType(new PostgresUuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid))); DefineSqlDataType(new PostgresUuidSqlDataType(this.ConstraintDefaultsConfiguration, typeof(Guid?))); } }
public DefaultStringSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration) : base(constraintDefaultsConfiguration, typeof(string)) { }
public PostgresDotConnectObjectTimespanSqlDataType(ConstraintDefaultsConfiguration constraintDefaultsConfiguration, Type supportedType) : base(constraintDefaultsConfiguration, supportedType) { }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { return(this.SqlName); }
public override string GetSqlName(PropertyDescriptor propertyDescriptor, ConstraintDefaultsConfiguration constraintDefaults) { return(this.dateTimeDataType.GetSqlName(propertyDescriptor, constraintDefaults)); }