示例#1
0
        public void DestroyService(TectureServiceBase serviceBase)
        {
            serviceBase.ServiceManager     = null;
            serviceBase.Pipeline           = null;
            serviceBase.ChannelMultiplexer = null;

            var st = serviceBase.GetType();

            if (serviceBase is INoContext)
            {
                if (_noContextServicesCache.ContainsKey(st))
                {
                    _noContextServicesCache.Remove(st);
                }
            }

            if (serviceBase is IWithContext)
            {
                if (_contextServices.ContainsKey(st))
                {
                    var lst = _contextServices[st];
                    lst.RemoveAll(d => d.ServiceBaseInstance == serviceBase);
                }
            }

            _allServices.Remove(serviceBase);
        }
        public void DestroyService(TectureServiceBase serviceBase)
        {
            serviceBase.ServiceManager     = null;
            serviceBase.Pipeline           = null;
            serviceBase.ChannelMultiplexer = null;

            var st = serviceBase.GetType();

            if (_noContextServicesCache.ContainsKey(st))
            {
                _noContextServicesCache.Remove(st);
            }

            _allServices.Remove(serviceBase);
        }
示例#3
0
        private void SaveExistingContextService(Type serviceType, Type[] contextTypes, object[] contextValues, TectureServiceBase instance)
        {
            var entry = new ServiceContextEntry()
            {
                ContextTypes        = contextTypes,
                Context             = contextTypes,
                ServiceBaseInstance = instance
            };

            if (!_contextServices.ContainsKey(serviceType))
            {
                _contextServices[serviceType] = new List <ServiceContextEntry>();
            }

            var sd = _contextServices[serviceType];

            sd.Add(entry);
        }