Defining an IsDirty property will the application to only save objects that have changes. This can increase performance when there are a large number of objects to save. If there is an IsDirty property and it is true OR if there is no IsDirty property, then the object will be updated.
'Get the current instance of the helper
Dim
db As IDataHelper = DataHelper.SessionFactory()
Dim
order As Order = New Order With {.Notes = "Initial notes"}
' New record is inserted
db.Save(order)
Dim
testOrder As Order = db.LoadByPrimaryKey(Of Order)(order.OrderId)
' Change a property
order.Notes =
"Updated notes"order.IsDirty =
False
' Save operation is ignored because IsDirty is false
db.Save(order)
' Make it dirty
order.IsDirty =
True
' Save updated record
db.Save(order)
testOrderDetail = db.LoadByPrimaryKey(
Of Order)(order.OrderId)