コード例 #1
0
        private void AddServiceImpl(
            ITisServicesHost servicesHost,
            string applicationName,
            object oServiceInstance,
            ITisServiceInfo oServiceInfo,
            string sEventSourceBindingKey)
        {
            if (!StringUtil.CompareIgnoreCase(sEventSourceBindingKey, TisServicesConst.UNNAMED_INSTANCE))
            {
                List <TisEventParams> SupportedEvents = GetSupportedEvents(oServiceInfo);

                if (SupportedEvents.Count != 0)
                {
                    ITisEventsManager oEventsMngr = (ITisEventsManager)servicesHost.GetService(applicationName, "EventsManager");

                    CreateServiceEventInterceptorTypeIfNeeded(
                        applicationName,
                        oServiceInfo,
                        SupportedEvents);

                    CreateServiceEventHandlers(
                        oServiceInstance,
                        oServiceInfo,
                        sEventSourceBindingKey,
                        SupportedEvents,
                        oEventsMngr);
                }
            }
        }
コード例 #2
0
        private void ObtainAllValidationContexts()
        {
            List <ITisValidationContext> typedValidationContexts;
            List <Type> validationTypes;

            lock (m_locker)
            {
                m_allValidationContexts.Clear();

                string[] validationContextServiceNames = TisServicesUtil.GetServicesOfImplType(
                    m_serviceRegistry,
                    typeof(ITisValidationContext));

                ITisValidationContext validationContext;

                foreach (string validationContextServiceName in validationContextServiceNames)
                {
                    try
                    {
                        validationContext =
                            (ITisValidationContext)m_servicesHost.GetService(m_applicationName, validationContextServiceName);
                    }
                    catch
                    {
                        validationContext = null;
                    }

                    if (validationContext != null)
                    {
                        validationTypes = ObtainValidationTypes(validationContext);

                        foreach (Type validationType in validationTypes)
                        {
                            if (validationType != null)
                            {
                                if (!m_allValidationContexts.ContainsKey(validationType))
                                {
                                    m_allValidationContexts.Add(validationType, new List <ITisValidationContext>());
                                }

                                typedValidationContexts = m_allValidationContexts[validationType];

                                typedValidationContexts.Add(validationContext);
                            }
                            else
                            {
                                Log.WriteWarning("Installed validation context service [{0}] does not provide validation target type", validationContextServiceName);
                            }
                        }
                    }
                    else
                    {
                        Log.WriteWarning("Validation service [{0}] is not installed", validationContextServiceName);
                    }
                }
            }
        }