I’m currently trying to figure out how to best handle the following update statement (postgres) in ormlite.
update supplierpart set isinstock = supplierwarehousepartinventory.onhand > 0, stocklastchangeddate = now() from
supplierwarehousepartinventory where supplierwarehousepartinventory.supplierid = supplierpart.supplierid and
supplierwarehousepartinventory.partid = supplierpart.partid
and supplierwarehousepartinventory.modifieddate >= now()- interval '3 days';
I attempted to try and use the following sqlexpression but couldn’t get the syntax correct for UpdateAll, if it’s even possible.
var recentStockQ = db.From<SupplierWarehousePartInventory>()
.Join<SupplierPart>((inventory, part) =>inventory.SupplierId == part.SupplierId && inventory.PartId == part.PartId)
.And(p => p.ModifiedDate >= stockDays)
.Update(r => new SupplierPart() {IsInStock = r.OnHand > 0, StockLastChangedDate = DateTime.Now});