Updating just the changed columns

Updating just the changed columns

Old forum URL: forums.lhotka.net/forums/t/8060.aspx


tiago posted on Sunday, November 29, 2009

I had a dream where I saw my Csla editable objects updating just the changed column.

The first step was made by Jason Bock's CustomFieldData classes. If I want to save just the changed columns, I must know for sure the exact properties that were changed.

Using Jason Bock's technique, I can add a few properties to PropertyInfo<T>, say

On the Dataportal side I can now prepare SQL update statements on the fly that update just the columns of the changed properties.

So what's the problem? These extra properties of PropertyInfo<T> must be present on the DataPortal side but have no business on the client side and I certainly don't want then to be serialized.

When I come to think of it, why properties? Why not static private fields? They are defined per type and not per instance, so they can be static all right. Can the DataPortal see them if they are private?

If I don't use an ObjectFactory, it's the same object on the client and on the DataPortal. So private fields are seen by the DataPortal.

If I use the ObjectFactory, these private fields may exists only on the factory, as the business object (the one that travels down the wires) has no use for them.

Anyone tried it yet?

Copyright (c) Marimer LLC