StrataFrame Forum

Only update changed field

http://forum.strataframe.net/Topic10872.aspx

By Chan - 8/15/2007

Hi,

I found that, SF BO generate update statement for all fields no matter has been changed or not when editing.



Anyway to configure BO to generate update SQL only for changed field?



Thank you
By Trent L. Taylor - 8/15/2007

This is why we added the FieldsToExcludeFromInsert and FieldsToExcludeFromUpdate properties to the BO.  This allows to you exclude fields from updating.  At present, there is not an automated way or a flag to only update changed fields.  There are a number of ways that these properties can be used, and they can be set programmatically at run-time as well.  So you have the ability to do this through these properties.

By Keith Chisarik - 7/24/2010

Can you provide a code snippet to set the FieldsToExcludeFromUpdate property programatically?

I need to set the property to all fields but a few so the BO's save is more efficient and then clear it again.

By Keith Chisarik - 7/24/2010

nevermind Smile

Array.Resize(boInventoryMaster.FieldsToExcludeFromUpdate, 1)

boInventoryMaster.FieldsToExcludeFromUpdate.SetValue("invm_batch", 0)