Hello, we are using LLBLGen pro 5.10.2, and we are encountering an issue trying to save an empty string property on an entity, this method worked previously in v4.0.
There are no errors or exceptions being thrown that I could find.
Database is Microsoft SQL server version ( KB4583458 ) - M15.0.2080.9 (X64)
The simplest example from our code:
public bool SaveEmploymentApplicationStepTwo(EmploymentApplicationModel model)
{
using (var adapter = new DataAccessAdapter(_config.GetConnectionString("umbracoDbDSN")))
{
var employmentApplicationEntity = new EmploymentApplicationEntity(model.ApplicationId)
{
AdditionalEducation = model.AdditionalEducation,
};
try
{
return adapter.SaveEntity(employmentApplicationEntity);
}
catch (Exception)
{
return false;
}
}
}
The types EmploymentApplicationEntity and DataAccessAdapter are both generated by LLBL. AdditionalEducation is nullable in the database and marked as optional in the LLBL designer. There are a few dozen other properties set here in addition to AdditionalEducation, I have removed them from this snippet to better focus on the example.
Steps to reproduce:
First enter any text for model.AdditionalEducation, lets say "Certificates", and run the above code.
Then update model.AdditionalEducation to be either null or empty string, and run the above code again.
Expected: The AdditionalEducation column on the EmploymentApplication table in the database is updated to be null or empty.
Actual: The AdditionalEducation column is unchanged from "Certificates".
Note that if you enter any non-empty string value, like "More certificates", the column updates as expected. Only null and empty strings are doing nothing.
I could not find anything in the version changelogs that mention this way of emptying properties being removed. Is this a bug or is there a better way of saving null properties to an entity?
Thank you!