public HandlerInvokeData GetInvokeData(Handler handler, Type eventType, ICollection <Entity> entities)
        {
            HandlerInvokeData data;

            if ((entities.Count == 0) || (entities.Count > 2))
            {
                return(Cache.flowInvokeData.GetInstance().Init(handler));
            }
            long id = 0L;
            long id = 0L;

            Collections.Enumerator <Entity> enumerator = Collections.GetEnumerator <Entity>(entities);
            while (enumerator.MoveNext())
            {
                if (id == 0L)
                {
                    id = enumerator.Current.Id;
                    continue;
                }
                id = enumerator.Current.Id;
            }
            HandlerContextDescription key = new HandlerContextDescription(handler, eventType, id, id);

            if (!this.invokeDataByDescription.TryGetValue(key, out data))
            {
                data = new HandlerInvokeData(handler);
                this.invokeDataByDescription.Add(key, data);
                enumerator = Collections.GetEnumerator <Entity>(entities);
                while (enumerator.MoveNext())
                {
                    this.contextDescriptionsByEntity.Add(enumerator.Current.Id, key);
                }
            }
            return(data);
        }
예제 #2
0
        protected bool UpdateInvokeData(HandlerInvokeData invokeData, Handler handler, Event eventInstance, Entity entity, ICollection <NodeDescription> changedNodes)
        {
            HandlerInvokeGraph handlerInvokeGraph = handler.HandlerInvokeGraph.Init();
            bool flag = reverseCombinator.Combine(handlerInvokeGraph, entity, changedNodes) && combinator.Combine(handlerInvokeGraph, null);

            if (flag)
            {
                invokeData.Update(eventInstance, handlerInvokeGraph);
            }
            handlerInvokeGraph.Clear();
            return(flag);
        }
예제 #3
0
        public virtual IList <HandlerInvokeData> Resolve(ICollection <Handler> handlers, Event eventInstance, ICollection <Entity> contextEntities)
        {
            if (handlers.Count == 0)
            {
                return(Collections.EmptyList <HandlerInvokeData>());
            }
            List <HandlerInvokeData> instance = Cache.listHandlersInvokeData.GetInstance();

            Collections.Enumerator <Handler> enumerator = Collections.GetEnumerator <Handler>(handlers);
            while (enumerator.MoveNext())
            {
                Handler           current    = enumerator.Current;
                HandlerInvokeData invokeData = ((EngineServiceImpl)EngineService).HandlerContextDataStorage.GetInvokeData(current, eventInstance.GetType(), contextEntities);
                if (invokeData.Reuse(eventInstance) || this.UpdateInvokeData(invokeData, current, eventInstance, contextEntities))
                {
                    instance.Add(invokeData);
                }
            }
            return(instance);
        }
예제 #4
0
        public virtual IList <HandlerInvokeData> Resolve(ICollection <Handler> handlers, Event eventInstance, Entity entity, ICollection <NodeDescription> changedNodes)
        {
            if (handlers.Count == 0)
            {
                return(Collections.EmptyList <HandlerInvokeData>());
            }
            List <HandlerInvokeData> instance = Cache.listHandlersInvokeData.GetInstance();

            Collections.Enumerator <Handler> enumerator = Collections.GetEnumerator <Handler>(handlers);
            while (enumerator.MoveNext())
            {
                Handler           current    = enumerator.Current;
                HandlerInvokeData invokeData = Cache.flowInvokeData.GetInstance().Init(current);
                if (this.UpdateInvokeData(invokeData, current, eventInstance, entity, changedNodes))
                {
                    instance.Add(invokeData);
                }
            }
            return(instance);
        }
예제 #5
0
        protected virtual bool UpdateInvokeData(HandlerInvokeData invokeData, Handler handler, Event eventInstance, ICollection <Entity> contextEntities)
        {
            if (handler.IsEventOnlyArguments)
            {
                invokeData.UpdateForEventOnlyArguments(eventInstance);
                return(true);
            }
            HandlerInvokeGraph handlerInvokeGraph = handler.HandlerInvokeGraph.Init();
            bool flag = combinator.Combine(handlerInvokeGraph, contextEntities);

            if (flag)
            {
                invokeData.Update(eventInstance, handlerInvokeGraph);
            }
            else
            {
                invokeData.UpdateForEmptyCall();
            }
            handlerInvokeGraph.Clear();
            return(flag);
        }