public void Clear()
{
id = null;
commitNeeded = true;
RetrievalInProcess = true;
ReadOnlyCollection<DBField> fieldList = DBField.GetFieldList(this.GetType());
foreach (DBField currField in fieldList) {
object defaultVal = currField.Default;
currField.SetValue(this, defaultVal);
// if this is a dynamic (internally changable) object, setup a listener
if (defaultVal != null && defaultVal.GetType() == typeof(IDynamic))
((IDynamic) defaultVal).Changed += new ChangedEventHandler(commitNeededEventHandler);
}
ReadOnlyCollection<DBRelation> relationList = DBRelation.GetRelations(this.GetType());
foreach (DBRelation currRelation in relationList) {
try {
currRelation.GetRelationList(this).Changed += new ChangedEventHandler(commitNeededEventHandler);
}
catch (NullReferenceException) {
throw new System.InvalidOperationException("RelationLists must be initialized in the get{} property method.");
}
}
RetrievalInProcess = false;
}