Пример #1
0
        /// <summary>
        /// 监听某个事件。
        /// </summary>
        /// <param name="theEvent">事件契约。</param>
        /// <param name="appRuntimeName">部署的实例名。</param>
        /// <param name="listenerClassName">监听者的类名。</param>
        /// <param name="handleMethodName">响应方法名。</param>
        public void ListenEvent(EventDC theEvent, string appRuntimeName, string listenerClassName, string handleMethodName)
        {
            RemoteEventListenEntity listenEt = new RemoteEventListenEntity();

            listenEt.AppRuntimeName      = appRuntimeName;
            listenEt.EventName           = theEvent.EventName;
            listenEt.HandleMethodName    = handleMethodName;
            listenEt.ListenerClassName   = listenerClassName;
            listenEt.SenderInterfaceName = theEvent.SenderInterfaceName;
            listenEt.SenderTypeName      = theEvent.SenderTypeName;

            listenEt.ProxyMapConfigKey = string.Empty;

            lock (locker)
            {
                Action act = delegate()
                {
                    if (!(dataPers.GetQueryable <RemoteEventListenEntity>().Where(ww => ww.EventListenKey == listenEt.EventListenKey).Count() > 0))
                    {
                        dataPers.Add(listenEt);
                    }
                };

                dataPers.WorkUnitAct(act);
            }
        }
Пример #2
0
        /// <summary>
        /// 取消某个事件的监听。
        /// </summary>
        /// <param name="theEvent">事件契约。</param>
        /// <param name="appRuntimeName">部署的实例名。</param>
        /// <param name="listenerClassName">监听者的类名。</param>
        /// <param name="handleMethodName">响应方法名。</param>
        public void RepealListen(EventDC theEvent, string appRuntimeName, string listenerClassName, string handleMethodName)
        {
            RemoteEventListenEntity listenEt = new RemoteEventListenEntity();

            listenEt.AppRuntimeName      = appRuntimeName;
            listenEt.EventName           = theEvent.EventName;
            listenEt.HandleMethodName    = handleMethodName;
            listenEt.ListenerClassName   = listenerClassName;
            listenEt.SenderInterfaceName = theEvent.SenderInterfaceName;
            listenEt.SenderTypeName      = theEvent.SenderTypeName;

            lock (locker)
            {
                dataPers.Delete(listenEt);
            }
        }
Пример #3
0
        /// <summary>
        /// 取消某事件的监听。
        /// </summary>
        /// <param name="theTypeMap">代理映射。</param>
        /// <param name="EventName">事件名。</param>
        /// <param name="ListenerFullName">事件响映函数所在的类名。</param>
        /// <param name="HandleMethodName">事件响映函数名。</param>
        public void RepealListen(TypeMap theTypeMap, string EventName, string ListenerFullName, string HandleMethodName)
        {
            RemoteEventListenEntity listenEnti = new RemoteEventListenEntity();

            listenEnti.EventName           = EventName;
            listenEnti.HandleMethodName    = HandleMethodName;
            listenEnti.ListenerClassName   = ListenerFullName;
            listenEnti.ProxyMapConfigKey   = string.IsNullOrWhiteSpace(theTypeMap.MapConfigKey) ? theTypeMap.InterfaceName : theTypeMap.MapConfigKey;
            listenEnti.SenderInterfaceName = theTypeMap.InterfaceName;
            listenEnti.SenderTypeName      = theTypeMap.MapToType;

            lock (eventList)
            {
                EventListenList.Remove(listenEnti);
            }
        }
Пример #4
0
        /// <summary>
        /// 监听某事件。
        /// </summary>
        /// <param name="theTypeMap">代理映射。</param>
        /// <param name="EventName">事件名。</param>
        /// <param name="ListenerFullName">事件响映函数所在的类名。</param>
        /// <param name="HandleMethodName">事件响映函数名。</param>
        public void LisetenEvent(TypeMap theTypeMap, string EventName, string ListenerFullName, string HandleMethodName)
        {
            RemoteEventListenEntity listenEnti = new RemoteEventListenEntity();

            listenEnti.AppRuntimeName      = AppSettings.AppRuntimeName;
            listenEnti.EventName           = EventName;
            listenEnti.HandleMethodName    = HandleMethodName;
            listenEnti.ListenerClassName   = ListenerFullName;
            listenEnti.ProxyMapConfigKey   = string.IsNullOrWhiteSpace(theTypeMap.MapConfigKey) ? theTypeMap.InterfaceName : theTypeMap.MapConfigKey;
            listenEnti.SenderInterfaceName = theTypeMap.InterfaceName;
            listenEnti.SenderTypeName      = theTypeMap.MapToType;

            lock (eventList)
            {
                if (!EventListenList.Exists(ww => ww.EventListenKey == listenEnti.EventListenKey))
                {
                    EventListenList.Add(listenEnti);
                }
            }
        }