SharePoint 2007 - Web Part property behavior

While developing and testing web parts, I tend to create public properties I don't need and vice-versa, I tend to not create public properties that I do need.  I have noticed some interesting behavior.

Let's say I include a public property called "Color".  While testing the web part, I populate this property with "Red".  As time goes by I decide that I don't need this property for some reason or other.  At this point I may have tested the web part on multiple sites.  Since I have decided that I no longer need the property I went ahead and deleted it from the web part assembly.  I then continue to test.  A little while later I said to myself, "Self, you forgot to delete the property values in the property (Color) you deleted a while ago.  Way to go, you now have orphaned data somewhere in your content database and have no way to find it, shame on you!"

I looked at my monitor for a few minutes and thought what if I recreated the property with the same name?  Would the data still be there?  I went ahead and did that and lo and behold, my property appeared and all of the data I had previously saved to this property was still there.

I'm sure this is a "Feature".

Do you think this is good or bad behavior and why?

Published 02 November 2006 11:42 AM by Dan Attis
Filed under:

Comments

No Comments