Convert null string to empty string when saving

Is it possible to convert a null value string to an empty string when a string value is stored in the database using db.Save(…) ?

(using Postgres dialect)

You should be able to use OrmLiteConfig.OnDbNullFilter to customize null values:

OrmLiteConfig.OnDbNullFilter = fieldDef => 
    fieldDef.FieldType == typeof(string)
        ? ""
        : null;
2 Likes