public void EntityAfterSaved(object sender, EntityEventArgs e)
 {
     if (IsTargetEntity(sender))
     {
         OnEntityAfterSaved(sender, e);
     }
 }
        public void RaiseAfterEvent(object sender, EntityEventArgs args)
        {
            Initialize();

            if (EntityAfter != null)
            {
                //EntityAfter.Invoke(sender, args);
                EntityAfter(sender, args);
            }
        }
        public void RaiseBeforeEvent(object sender, EntityEventArgs args)
        {
            Initialize();

            if (EntityBefore != null)
            {
                //EntityBefore.Invoke(sender, args);
                EntityBefore(sender, args);
            }
        }
예제 #4
0
        public void RaiseAfterEvent(object sender, EntityEventArgs args)
        {
            Initialize();

            if (EntityAfter != null)
            {
                //EntityAfter.Invoke(sender, args);
                EntityAfter(sender, args);
            }
        }
예제 #5
0
        public void RaiseBeforeEvent(object sender, EntityEventArgs args)
        {
            Initialize();

            if (EntityBefore != null)
            {
                //EntityBefore.Invoke(sender, args);
                EntityBefore(sender, args);
            }
        }
예제 #6
0
        private EntityEventArgs CreateArgs(DbEntityEntry item, EntityState state)
        {
            PropertyValues originalValues = null;
            PropertyValues currentValues = null;

            if (state == EntityState.Modified && !(item.State == EntityState.Detached))
            {
                originalValues = new PropertyValues(item.OriginalValues);
                currentValues = new PropertyValues(item.CurrentValues);
            }

            var args = new EntityEventArgs(state, originalValues, currentValues);
            return args;
        }
        protected override void OnEntityAfterSaved(object sender, EntityEventArgs e)
        {
            T tItem = (T)sender;

            switch (e.State)
            {
            case EntityState.Added:
                this.OnAfterInsert(tItem, e);
                break;

            case EntityState.Deleted:
                this.OnAfterDelete(tItem, e);
                break;

            case EntityState.Modified:
                this.OnAfterUpdate(tItem, e);
                break;
            }
        }
예제 #8
0
 protected abstract void OnEntityAfterSaved(object sender, EntityEventArgs e);
예제 #9
0
 protected abstract void OnEntityBeforeSaved(object sender, EntityEventArgs e);
예제 #10
0
 protected abstract void OnEntityAfterSaved(object sender, EntityEventArgs e);
예제 #11
0
 protected abstract void OnEntityBeforeSaved(object sender, EntityEventArgs e);
 public virtual void OnAfterDelete(T item, EntityEventArgs e)
 {
     return;
 }
 public virtual void OnBeforeDelete(T item, EntityEventArgs e)
 {
     return;
 }
 public virtual void OnAfterInsert(T item, EntityEventArgs e)
 {
     return;
 }
 public virtual void OnBeforeInsert(T item, EntityEventArgs e)
 {
     return;
 }