Allow Join with UpdateOnly
Trying to UpdateOnly, when onlyField is typed as SqlExpression and the query has a Join an error will be thrown that says "The multi-part identifier "DepartmentJobCode.DepartmentId" could not be bound."
Example:
var jobsQuery = _db.From<dev.ScheduleEvent>()
.Join<dev.DepartmentJobCode>((se,jc)=> se.Job == jc.JobTitleId)
.Where<dev.DepartmentJobCode>(e => Sql.In(e.DepartmentId, departments))
.Update(x => new { x.Published, x.ModifiedBy});
db.UpdateOnly(new dev.ScheduleEvent { Published = false, ModifiedBy = userId}, onlyFields: jobsQuery);
7
votes
