コード例 #1
0
        /// <summary>
        /// Subscribe data access event in global area
        /// </summary>
        /// <param name="eventHandleOperation">Event handle operation</param>
        public void SubscribeAll(Func <IDataAccessEvent, DataAccessEventExecuteResult> eventHandleOperation)
        {
            IDataAccessEventHandler domainEventHandler = new DefaultDataAccessEventHandler <IDataAccessEvent>()
            {
                ExecuteEventOperation = eventHandleOperation
            };

            SubscribeAll(domainEventHandler);
        }
コード例 #2
0
        /// <summary>
        /// Subscribe entity data access event
        /// </summary>
        /// <typeparam name="TEntity">Entity type</typeparam>
        /// <typeparam name="TEvent">Event type</typeparam>
        /// <param name="eventHandleOperation">Event handle operation</param>
        public void SubscribeEntity <TEntity, TEvent>(Func <TEvent, DataAccessEventExecuteResult> eventHandleOperation) where TEvent : class, IDataAccessEvent
        {
            IDataAccessEventHandler domainEventHandler = new DefaultDataAccessEventHandler <TEvent>()
            {
                ExecuteEventOperation = eventHandleOperation
            };

            SubscribeEntity <TEntity, TEvent>(domainEventHandler);
        }
コード例 #3
0
ファイル: DataAccessEventBus.cs プロジェクト: eznew-net/EZNEW
 /// <summary>
 /// Subscribe aggregate function event
 /// </summary>
 /// <param name="eventHandleOperation">Event operation</param>
 /// <param name="applyToEntity">Apply to entity</param>
 /// <param name="entityTypes">Entity types</param>
 public static void SubscribeAggregateFunction(Func <AggregateFunctionEvent, DataAccessEventExecuteResult> eventHandleOperation, bool applyToEntity = false, params Type[] entityTypes)
 {
     if (eventHandleOperation == null || (applyToEntity && entityTypes.IsNullOrEmpty()))
     {
         return;
     }
     if (applyToEntity)
     {
         var handler = new DefaultDataAccessEventHandler <AggregateFunctionEvent>()
         {
             ExecuteEventOperation = eventHandleOperation
         };
         foreach (var entity in entityTypes)
         {
             SubscribeEntity <AggregateFunctionEvent>(entity, handler);
         }
     }
     else
     {
         Subscribe(eventHandleOperation);
     }
 }