示例#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
        /// 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;
        }
示例#3
0
文件: IdEntity.cs 项目: GFlisch/Arc4u
 /// <summary>
 /// Initializes a new instance of the <see cref="IdEntity"/> class
 /// with the specified <see cref="PersistChange"/>
 /// </summary>
 /// <param name="persistChange">The persist change.</param>
 protected IdEntity(PersistChange persistChange)
     : base(persistChange)
 {
     Id = Guid.NewGuid();
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateAuditEntity"/> class
 /// with the specified <see cref="PersistChange"/>
 /// </summary>
 /// <param name="persistChange">The persist change.</param>
 public UpdateAuditEntity(PersistChange persistChange)
     : base(persistChange)
 {
     Id        = Guid.NewGuid();
     CreatedOn = DateTimeOffset.UtcNow;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateAuditEntity&lt;TId,TCreatedBy,TCreatedOn&gt;"/> class
 /// with the specified <see cref="PersistChange"/>
 /// </summary>
 /// <param name="persistChange">The persist change.</param>
 public CreateAuditEntity(PersistChange persistChange) : base(persistChange)
 {
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdEntity&lt;TId&gt;"/> class
 /// with the specified <see cref="PersistChange"/>
 /// </summary>
 /// <param name="persistChange">The persist change.</param>
 protected IdEntity(PersistChange persistChange) : base(persistChange)
 {
 }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PersistEntity"/> class
 /// with the specified <see cref="PersistChange"/>.
 /// </summary>
 /// <param name="persistChange">The persist change.</param>
 protected PersistEntity(PersistChange persistChange)
 {
     _persistChange = persistChange;
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuditEntity&lt;TId,TAuditedBy,TAuditedOn&gt;"/> class
 /// with the specified <see cref="PersistChange"/>
 /// </summary>
 /// <param name="persistChange">The persist change.</param>
 protected AuditEntity(PersistChange persistChange)
     : base(persistChange)
 {
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuditEntity"/> class
 /// with the specified <see cref="PersistChange"/>
 /// </summary>
 /// <param name="persistChange">The persist change.</param>
 public AuditEntity(PersistChange persistChange) : base(persistChange)
 {
     Id = Guid.NewGuid();
 }