In Python, there is this useful exception handling code:
try:
# Code that could raise an exception
except Exception:
# Exception handling
else:
# Cod
You could do something like this:
if (!IsReadOnly)
{
T newobj = null;
try
{
newobj = DataPortal.Update(this);
}
catch (DataPortalException)
{
// TODO: Implement DataPortal.Update() recovery mechanism
}
if (newobj != null)
{
List keys = new List(BasicProperties.Keys);
foreach (string key in keys)
{
BasicProperties[key] = newobj.BasicProperties[key];
}
}
}