I think the DesignMode
property of the Control class is what you are looking for:
public string ReadWriteDBValue
{
get
{
if (!this.DesignMode)
return GetValueFromDB();
else
return string.Empty;
}
set
{
if (!this.DesignMode)
SetValueFromDB(value);
}
}
There are certain cases where the DesignMode property will not help. Here is a post that talks more about the DesignMode property:
http://dotnetfacts.blogspot.com/2009/01/identifying-run-time-and-design-mode.html
So in the past I've used the DesignMode
property in combination with the System.ComponentModel.LicenseManager.UsageMode
property.
if (!this.DesignMode && System.ComponentModel.LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
//insert code that you do not want to be performed at design time.
}