SubSonic-3.0
SubSonic-3.0 copied to clipboard
Update where a property is set to null isn't translated correctly.
Next Update crashes because the x => x.Name == null will be translated to a Comparison.Is. As a consequence, in Update.cs, a InvalidOperationException is thrown saying 'Can't use a non-equality here'.
In the Where part, this would be correct but in the Set part it should be translated to a Comparison.Equals.
var affectedRecords = Db.Update<Schedule>()
.Set(x => x.Name == null,
x => x.Description == entity.description)
.Where(x => x.ScheduleId == entity.id && x.Version == entity.version)
.Execute();
I solved this by adding a line in the Set method in Update.cs before the check on equality comparison.
if (c.Comparison == Comparison.Is) c.Comparison = Comparison.Equals;