/** * <summary> * This is a pretty lazy method of adding enums, it just converts to string * </summary> * <param name="helper"></param> * <param name="columnName"></param> * <param name="dbEnumName">this currently isn't used, in the future it could be used to validate</param> * <param name="propertyGetter"></param> * <typeparam name="TEntity"></typeparam> * <typeparam name="TEnum"></typeparam> * <returns></returns> */ public static PostgreSQLCopyHelper <TEntity> MapEnum <TEntity, TEnum>( this PostgreSQLCopyHelper <TEntity> helper, string columnName, string dbEnumName, Func <TEntity, TEnum> propertyGetter) { return(helper.Map(columnName, (x) => { string value = propertyGetter(x).ToString(); var newName = Regex.Replace( value, "[a-z][A-Z]", Q => $"{Q.Value[ 0 ]}_{Q.Value[ 1 ]}" ).ToLower(); // Console.WriteLine($"propertyGetter: {propertyGetter}={propertyGetter(x)}={newName}"); return newName; }, NpgsqlDbType.Text)); }
public static PostgreSQLCopyHelper <TEntity> MapBoolean <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, bool> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Boolean)); }
public static PostgreSQLCopyHelper <TEntity> MapBit <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, bool?> propertyGetter) { return(helper.MapNullable(columnName, propertyGetter, NpgsqlDbType.Bit)); }
public static PostgreSQLCopyHelper <TEntity> MapArray <TEntity, TProperty>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, TProperty> propertyGetter, NpgsqlDbType type) { return(helper.Map <TProperty>(columnName, propertyGetter, (NpgsqlDbType.Array | type))); }
public static PostgreSQLCopyHelper <TEntity> MapArray <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, Double[]> propertyGetter) { return(MapArray(helper, columnName, propertyGetter, NpgsqlDbType.Double)); }
public static PostgreSQLCopyHelper <TEntity> MapInterval <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, TimeSpan?> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Interval)); }
public static PostgreSQLCopyHelper <TEntity> MapTimeStampTz <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, ZonedDateTime> propertyGetter) { NodaTimeTypeExtensions.AddUseNodaTime(); return(helper.Map(columnName, propertyGetter, NpgsqlDbType.TimestampTz)); }
public static PostgreSQLCopyHelper <TEntity> MapMacAddress <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, PhysicalAddress> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.MacAddr)); }
public static PostgreSQLCopyHelper <TEntity> MapUUID <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, Guid> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Uuid)); }
public static PostgreSQLCopyHelper <TEntity> MapBigInt <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, Int64> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Bigint)); }
public static PostgreSQLCopyHelper <TEntity> MapSmallInt <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, Int16?> propertyGetter) { return(helper.MapNullable(columnName, propertyGetter, NpgsqlDbType.Smallint)); }
public static PostgreSQLCopyHelper <TEntity> MapTimeTz <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, OffsetTime?> propertyGetter) { NodaTimeTypeExtensions.AddUseNodaTime(); return(helper.MapNullable(columnName, propertyGetter, NpgsqlDbType.TimeTz)); }
public static PostgreSQLCopyHelper <TEntity> MapInterval <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, Period> propertyGetter) { NodaTimeTypeExtensions.AddUseNodaTime(); return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Interval)); }
public static PostgreSQLCopyHelper <TEntity> MapText <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, String> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Text)); }
public static PostgreSQLCopyHelper <TEntity> MapTimeTz <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, TimeSpan?> propertyGetter) { return(helper.MapNullable(columnName, propertyGetter, NpgsqlDbType.TimeTz)); }
public static PostgreSQLCopyHelper <TEntity> MapMoney <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, Decimal?> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Money)); }
public static PostgreSQLCopyHelper <TEntity> MapTimeStamp <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, DateTime?> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Timestamp)); }
public static PostgreSQLCopyHelper <TEntity> MapByteArray <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, byte[]> propertyGetter) { return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Bytea)); }
public static PostgreSQLCopyHelper <TEntity> MapDate <TEntity>(this PostgreSQLCopyHelper <TEntity> helper, string columnName, Func <TEntity, LocalDate> propertyGetter) { NodaTimeTypeExtensions.AddUseNodaTime(); return(helper.Map(columnName, propertyGetter, NpgsqlDbType.Date)); }