/// <summary> /// Raises the InstanceRelationChanged event. /// </summary> /// <param name="relation">The <see cref="InstanceDescriptorInstanceRelation"/> relation.</param> /// <param name="changeType">The type of change occured.</param> /// <exception cref="ArgumentNullException">The value of '<paramref name="relation"/>' cannot be null.</exception> private void OnInstanceRelationChanged([NotNull] InstanceDescriptorInstanceRelation relation, InstanceRelationChangeType changeType) { if (relation == null) { throw new ArgumentNullException(nameof(relation)); } var handler = this.instanceRelationChanged; handler?.Invoke(this, new InstanceRelationChangedEventArgs(relation.InstanceDescriptor, relation.Instance, changeType)); }
/// <summary> /// Initializes a new instance of the <see cref="InstanceRelationChangedEventArgs"/> class. /// </summary> /// <param name="instanceDescriptor">The associated <see cref="InstanceDescriptor"/>.</param> /// <param name="instance">The associated instance.</param> /// <param name="changeType">The type of changed occured.</param> /// <exception cref="ArgumentNullException">The value of '<paramref name="instanceDescriptor"/>' and '<paramref name="instance"/>' cannot be null.</exception> public InstanceRelationChangedEventArgs([NotNull] InstanceDescriptor instanceDescriptor, [NotNull] Object instance, InstanceRelationChangeType changeType) { if (instanceDescriptor == null) { throw new ArgumentNullException(nameof(instanceDescriptor)); } if (instance == null) { throw new ArgumentNullException(nameof(instance)); } this.InstanceDescriptor = instanceDescriptor; this.Instance = instance; this.ChangeType = changeType; }