Exemplo n.º 1
0
        /// <summary>
        /// Raises event, looks for listeners and invoke their event handling method
        /// </summary>
        /// <param name="eventArgs">Event arguments</param>
        /// <param name="eventType">Event type</param>
        public static void RaiseEvent <TEntity>(EntityEventArgs <TEntity> eventArgs, Type eventType) where TEntity : Entity
        {
            //Raise specific entity type event
            Type entityType = typeof(TEntity);

            RaiseEvent(eventArgs, entityType, eventType);

            //Raise generic entity type event
            Type genericEntityType = typeof(Entity);
            EntityEventArgs <Entity> genericArgs = eventArgs.Entity != null
                                ? new EntityEventArgs <Entity>(eventArgs.Entity)
                                : new EntityEventArgs <Entity>(eventArgs.EntityId);

            RaiseEvent(genericArgs, genericEntityType, eventType);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raises event, looks for listeners and invoke their event handling method
        /// </summary>
        /// <param name="entity">Entity that causes the event</param>
        /// <param name="eventType">Event type</param>
        public static void RaiseEvent(object entity, Type eventType)
        {
            //Raise generic entity type event
            Type genericEntityType = typeof(Entity);
            EntityEventArgs <Entity> genericArgs = entity as Entity != null
                                ? new EntityEventArgs <Entity>((Entity)entity)
                                : new EntityEventArgs <Entity>();

            RaiseEvent(genericArgs, genericEntityType, eventType);

            //Raise specific entity type event
            Type entityType    = GetEntityType(entity);
            Type eventArgsType = typeof(EntityEventArgs <>).MakeGenericType(entityType);
            var  eventArgs     = Activator.CreateInstance(eventArgsType, entity);

            RaiseEvent(eventArgs, entityType, eventType);
        }
Exemplo n.º 3
0
 protected EventHandlingException(SerializationInfo info, StreamingContext context, EntityEventArgs <TEntity> eventArgs)
     : base(info, context, typeof(TEvent), eventArgs)
 {
 }
Exemplo n.º 4
0
 public EventHandlingException(string message, Exception innerException, EntityEventArgs <TEntity> eventArgs)
     : base(message, innerException, typeof(TEvent), eventArgs)
 {
 }
Exemplo n.º 5
0
 public EventHandlingException(EntityEventArgs <TEntity> eventArgs)
     : base(typeof(TEvent), eventArgs)
 {
 }