internal void OnPropertyChanged(object source, PropertyChangedEventArgs eventArgs) { Util.CheckArgumentNull <object>(source, "source"); Util.CheckArgumentNull <PropertyChangedEventArgs>(eventArgs, "eventArgs"); string propertyName = eventArgs.PropertyName; if (string.IsNullOrEmpty(propertyName)) { this.HandleUpdateEntity(source, null, null); } else { BindingEntityInfo.BindingPropertyInfo info; ClientPropertyAnnotation annotation; object obj2; if (BindingEntityInfo.TryGetPropertyValue(source, propertyName, this.Context.MaxProtocolVersion, out info, out annotation, out obj2)) { if (info == null) { if (!annotation.IsStreamLinkProperty) { this.HandleUpdateEntity(source, propertyName, obj2); } } else { this.bindingGraph.RemoveRelation(source, propertyName); switch (info.PropertyKind) { case BindingPropertyKind.BindingPropertyKindEntity: this.bindingGraph.AddEntity(source, propertyName, obj2, null, source); return; case BindingPropertyKind.BindingPropertyKindDataServiceCollection: if (obj2 == null) { return; } try { typeof(BindingUtils).GetMethod("VerifyObserverNotPresent", false, true).MakeGenericMethod(new Type[] { info.PropertyInfo.EntityCollectionItemType }).Invoke(null, new object[] { obj2, propertyName, source.GetType() }); } catch (TargetInvocationException exception) { throw exception.InnerException; } try { this.AttachBehavior = true; this.bindingGraph.AddDataServiceCollection(source, propertyName, obj2, null); return; } finally { this.AttachBehavior = false; } break; case BindingPropertyKind.BindingPropertyKindPrimitiveOrComplexCollection: break; default: if (obj2 != null) { this.bindingGraph.AddComplexObject(source, propertyName, obj2); } this.HandleUpdateEntity(source, propertyName, obj2); return; } if (obj2 != null) { this.bindingGraph.AddPrimitiveOrComplexCollection(source, propertyName, obj2, info.PropertyInfo.PrimitiveOrComplexCollectionItemType); } this.HandleUpdateEntity(source, propertyName, obj2); } } } }