void InvokeOnDeserializing(ClassDataContract classContract) { if (classContract.BaseContract != null) { InvokeOnDeserializing(classContract.BaseContract); } if (classContract.OnDeserializing != null) { classContract.OnDeserializing.Invoke(objectLocal, new object [] { context.GetStreamingContext() }); } }
static internal void InvokeOnDeserialized(object value, DataContract contract, XmlObjectSerializerReadContextComplexJson context) { if (contract is ClassDataContract) { ClassDataContract classContract = contract as ClassDataContract; if (classContract.BaseContract != null) { InvokeOnDeserialized(value, classContract.BaseContract, context); } if (classContract.OnDeserialized != null) { bool memberAccessFlag = classContract.RequiresMemberAccessForRead(null, JsonGlobals.JsonSerializationPatterns); try { DisallowMemberAccess(memberAccessFlag); classContract.OnDeserialized.Invoke(value, new object[] { context.GetStreamingContext() }); } catch (SecurityException securityException) { if (memberAccessFlag) { classContract.RequiresMemberAccessForRead(securityException, JsonGlobals.JsonSerializationPatterns); } else { throw; } } catch (TargetInvocationException targetInvocationException) { if (targetInvocationException.InnerException == null) { throw; } //We are catching the TIE here and throws the inner exception only, //this is needed to have a consistent exception story in all serializers throw targetInvocationException.InnerException; } } } }
static internal void InvokeOnDeserialized(object value, DataContract contract, XmlObjectSerializerReadContextComplexJson context) { if (contract is ClassDataContract) { ClassDataContract classContract = contract as ClassDataContract; if (classContract.BaseContract != null) InvokeOnDeserialized(value, classContract.BaseContract, context); if (classContract.OnDeserialized != null) { bool memberAccessFlag = classContract.RequiresMemberAccessForRead(null); try { classContract.OnDeserialized.Invoke(value, new object[] { context.GetStreamingContext() }); } catch (SecurityException securityException) { if (memberAccessFlag) { classContract.RequiresMemberAccessForRead(securityException); } else { throw; } } catch (TargetInvocationException targetInvocationException) { if (targetInvocationException.InnerException == null) throw; //We are catching the TIE here and throws the inner exception only, //this is needed to have a consistent exception story in all serializers throw targetInvocationException.InnerException; } } } }