Handling exceptions with self-tracking entities is ugly because one must parse the (localized?) message string. Please expose an error code with InvalidOperationException.
It is not clear to me why STEs throw an InvalidOperationException at all instead of an UpdateExeption for normal errors like "The relationship could not be changed because one or more of the foreign-key properties is non-nullable..."
For details see:
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/8ee96457-0182-4e6c-a925-d8c87b13be65
It is not clear to me why STEs throw an InvalidOperationException at all instead of an UpdateExeption for normal errors like "The relationship could not be changed because one or more of the foreign-key properties is non-nullable..."
For details see:
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/8ee96457-0182-4e6c-a925-d8c87b13be65