示例#1
0
        private ServiceInspector GetServiceInspector(Service service)
        {
            ServiceInspector inspector = null;

            if (!m_serviceInspectors.TryGetValue(BTServiceInspectorFactory.GetInspectorTypeForService(service.GetType()), out inspector))
            {
                inspector = BTServiceInspectorFactory.CreateInspectorForService(service);
                m_serviceInspectors.Add(inspector.GetType(), inspector);
            }

            inspector.Target = service;
            return(inspector);
        }
示例#2
0
        public static ServiceInspector CreateInspectorForService(Service service)
        {
            if (service != null)
            {
                Type inspectorType = GetInspectorTypeForService(service.GetType());
                if (inspectorType != null)
                {
                    ServiceInspector inspector = Activator.CreateInstance(inspectorType) as ServiceInspector;
                    inspector.Target = service;

                    return(inspector);
                }
            }

            return(null);
        }