Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AggregateChangedEventArgs"/> class.
        /// </summary>
        /// <param name="aggregateRoot">The aggregate root.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="aggregateChangedType">Type of the aggregate changed.</param>
        /// <param name="collectionItem">The collection item.</param>
        public AggregateChangedEventArgs(
            IAggregateRoot aggregateRoot,
            IEntity entity,
            string propertyName,
            AggregateChangedType aggregateChangedType,
            object collectionItem)
        {
            if (aggregateRoot == null)
            {
                throw new ArgumentNullException("aggregateRoot");
            }

            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            if (string.IsNullOrWhiteSpace(propertyName))
            {
                throw new ArgumentNullException("propertyName");
            }

            if (aggregateChangedType == AggregateChangedType.PropertyValueChanged)
            {
                throw new ArgumentException("This constructor is for collection changes only.");
            }

            if (collectionItem == null)
            {
                throw new ArgumentNullException("collectionItem");
            }

            AggregateChangedType = aggregateChangedType;
            AggregateRoot        = aggregateRoot;
            SourceEntity         = entity;
            PropertyName         = propertyName;

            if (AggregateChangedType == AggregateChangedType.CollectionItemAdded)
            {
                NewValue = collectionItem;
            }
            else
            {
                OldValue = collectionItem;
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AggregateChangedEventArgs"/> class.
        /// </summary>
        /// <param name="aggregateRoot">The aggregate root.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="aggregateChangedType">Type of the aggregate changed.</param>
        /// <param name="collectionItem">The collection item.</param>
        public AggregateChangedEventArgs(
            IAggregateRoot aggregateRoot,
            IEntity entity,
            string propertyName,
            AggregateChangedType aggregateChangedType,
            object collectionItem )
        {
            if ( aggregateRoot == null )
            {
                throw new ArgumentNullException ( "aggregateRoot" );
            }

            if ( entity == null )
            {
                throw new ArgumentNullException ( "entity" );
            }

            if ( string.IsNullOrWhiteSpace ( propertyName ) )
            {
                throw new ArgumentNullException ( "propertyName" );
            }

            if ( aggregateChangedType == AggregateChangedType.PropertyValueChanged )
            {
                throw new ArgumentException ( "This constructor is for collection changes only." );
            }

            if ( collectionItem == null )
            {
                throw new ArgumentNullException ( "collectionItem" );
            }

            AggregateChangedType = aggregateChangedType;
            AggregateRoot = aggregateRoot;
            SourceEntity = entity;
            PropertyName = propertyName;

            if ( AggregateChangedType == AggregateChangedType.CollectionItemAdded )
            {
                NewValue = collectionItem;
            }
            else
            {
                OldValue = collectionItem;
            }
        }