示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PersistEntity"/> class
        /// copied from the specified <paramref name="entity"/>.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <exception cref="ArgumentNullException"><paramref name="entity"/> is null.</exception>
        protected PersistEntity(PersistEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            _persistChange = entity._persistChange;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityItem&lt;TEntity&gt;"/> class
        /// copied from the specified <paramref name="item"/>.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <exception cref="ArgumentNullException"><paramref name="item"/> is null.</exception>
        public EntityItem(EntityItem <TEntity> item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            this._entity        = item._entity;
            this._persistChange = item._persistChange;
            this._persistEntity = item._persistEntity;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityItem&lt;TEntity&gt;"/> class
        /// with the specified <see cref="PersistChange"/>.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="persistChange">The persist change.</param>
        /// <exception cref="ArgumentNullException"><paramref name="entity"/> is null.</exception>
        public EntityItem(TEntity entity, PersistChange persistChange)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            _entity        = entity;
            _persistEntity = entity as PersistEntity;

            if (_persistEntity != null)
            {
                _persistEntity.PropertyChanged += new PropertyChangedEventHandler(Entity_PropertyChanged);
            }

            _persistChange = persistChange;
        }