What's the best way to avoid (or control) the initialisation by the designer of a heavy custom property in .NET? Sometimes it is important to have a property set to something initially without that setting being acted upon when initially set.
In the imaginary example below, I want to achieve the flexibility of having something like UpdateSetting as a property, but not the inconvenience of having the database set to zero every time the application starts up. All I can think of is another property that unlocks a flag.
public class A : UserControl
{
public int UpdateSetting
{
// Write to database or some such thing
}
...
public void InitializeComponent()
{
A a = new A();
a.UpdateSetting = 0; // Causes database write
}
}