public IComponentDescriptor RegisterDisabledComponent(IServiceDescriptor service, string componentId, Type componentType)
            {
                var component = RegisterComponent(service, componentId, componentType);

                component.Plugin.Disable("Disabled component.");
                return(component);
            }
            public IComponentDescriptor RegisterComponent(IServiceDescriptor service, string componentId, Type componentType)
            {
                var plugin    = RegisterPlugin(service.Plugin);
                var component = RegisterComponent(new ComponentRegistration(plugin, service, componentId, new TypeName(componentType)));

                return(component);
            }
Exemplo n.º 3
0
        public void InstallService(IServiceDescriptor serviceDescriptor)
        {
            PropertyDataCollection outParams;
            long returnValue;

            var inParamsCollection = new List<PropertyDataObject>();
            inParamsCollection.Add(new PropertyDataObject() { Name = "Name", Value = serviceDescriptor.Name });
            inParamsCollection.Add(new PropertyDataObject() { Name = "DisplayName", Value = serviceDescriptor.DisplayName });
            inParamsCollection.Add(new PropertyDataObject() { Name = "PathName", Value = serviceDescriptor.Path });
            inParamsCollection.Add(new PropertyDataObject() { Name = "ServiceType", Value = (ushort)serviceDescriptor.Type });
            inParamsCollection.Add(new PropertyDataObject() { Name = "ErrorControl", Value = (ushort)serviceDescriptor.ErrorControl });
            inParamsCollection.Add(new PropertyDataObject() { Name = "StartMode", Value = Enum.GetName(typeof(ServiceStartMode), serviceDescriptor.StartMode) });
            inParamsCollection.Add(new PropertyDataObject() { Name = "DesktopInteract", Value = serviceDescriptor.DesktopInteraction });
            inParamsCollection.Add(new PropertyDataObject() { Name = "StartName", Value = serviceDescriptor.UserAccount});
            inParamsCollection.Add(new PropertyDataObject() { Name = "StartPassword", Value = serviceDescriptor.Password });
            inParamsCollection.Add(new PropertyDataObject() { Name = "ServiceDependencies", Value = serviceDescriptor.ServiceDependencies.ToArray<string>() });

            _handler.Handle("Create", inParamsCollection, out outParams);

            returnValue = long.Parse(outParams["ReturnValue"].Value.ToString());

            if (returnValue != 0)
            {
                throw new ProcessInstrumentationException(@"{0} {1}.", ExceptionMessages.Win32_ServiceControlFail, _errorMessageProvider.GetErrorMessage(ErrorMessageProvider.ErrorClass.Win32_Service_Create, returnValue));
            }
        }
 /// <summary>
 /// Creates a component registration.
 /// </summary>
 /// <param name="plugin">The plugin to which the component will belong.</param>
 /// <param name="service">The service implemented by the component.</param>
 /// <param name="componentId">The component id.</param>
 /// <param name="componentTypeName">The component type name, or null to use the default component type specified by the service.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="plugin"/>, <paramref name="service"/>,
 /// <paramref name="componentId"/> is null.</exception>
 public ComponentRegistration(IPluginDescriptor plugin, IServiceDescriptor service, string componentId, TypeName componentTypeName)
 {
     Plugin = plugin;
     Service = service;
     ComponentId = componentId;
     ComponentTypeName = componentTypeName;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a component registration.
 /// </summary>
 /// <param name="plugin">The plugin to which the component will belong.</param>
 /// <param name="service">The service implemented by the component.</param>
 /// <param name="componentId">The component id.</param>
 /// <param name="componentTypeName">The component type name, or null to use the default component type specified by the service.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="plugin"/>, <paramref name="service"/>,
 /// <paramref name="componentId"/> is null.</exception>
 public ComponentRegistration(IPluginDescriptor plugin, IServiceDescriptor service, string componentId, TypeName componentTypeName)
 {
     Plugin            = plugin;
     Service           = service;
     ComponentId       = componentId;
     ComponentTypeName = componentTypeName;
 }
Exemplo n.º 6
0
        /// <inheritdoc />
        public IServiceDescriptor RegisterService(ServiceRegistration serviceRegistration)
        {
            if (serviceRegistration == null)
            {
                throw new ArgumentNullException("serviceRegistration");
            }

            return(dataBox.Write(data =>
            {
                if (data.GetPluginById(serviceRegistration.Plugin.PluginId) != serviceRegistration.Plugin)
                {
                    throw new ArgumentException("The specified plugin descriptor does not belong to this registry.", "serviceRegistration");
                }
                if (data.GetServiceById(serviceRegistration.ServiceId) != null)
                {
                    throw new ArgumentException(string.Format("There is already a service registered with id '{0}'.", serviceRegistration.ServiceId), "serviceRegistration");
                }
                IServiceDescriptor otherService = data.GetServiceByServiceTypeName(serviceRegistration.ServiceTypeName);
                if (otherService != null)
                {
                    throw new ArgumentException(string.Format("There is already a service registered with type name '{0}'.  This service has id '{1}' and the other service has id '{2}'.",
                                                              serviceRegistration.ServiceTypeName, serviceRegistration.ServiceId, otherService.ServiceId), "serviceRegistration");
                }

                ServiceDescriptor service = new ServiceDescriptor(this, serviceRegistration);
                data.RegisterService(service);
                return service;
            }));
        }
Exemplo n.º 7
0
 private static long CalculateHash(IServiceDescriptor descriptor)
 {
     return(((((long)descriptor.Lifecycle * 397)
              ^ descriptor.ServiceType.GetHashCode()) * 397)
            ^ (descriptor.ImplementationInstance
               ?? descriptor.ImplementationType
               ?? (object)descriptor.ImplementationFactory).GetHashCode());
 }
        private void RegisterComponent(string componentId, TypeName typeName, IPluginDescriptor plugin,
                                       IServiceDescriptor serviceDescriptor)
        {
            var componentRegistration = new ComponentRegistration(plugin, serviceDescriptor,
                                                                  componentId, typeName);

            registry.RegisterComponent(componentRegistration);
        }
Exemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceName"></param>
        /// <returns></returns>
        public IServiceDescriptor GetServiceDescriptor(string serviceName)
        {
            Guard.NotNull(serviceName, "serviceName");

            IServiceDescriptor desc = null;

            Metadatas.TryGetValue(serviceName, out desc);
            return(desc);
        }
Exemplo n.º 10
0
        //TODO:
        public void OnServiceDescriptorResolved(IServiceDescriptor serviceDescriptor)
        {
            var errorNavigation = serviceDescriptor.ServiceType.GetAttribute <RedirectToErrorAttribute>(true);

            if (errorNavigation != null)
            {
                serviceDescriptor.Extensions[ControllerListener.ErrorNavigation] = errorNavigation;
            }
        }
Exemplo n.º 11
0
 public static string GetEndpointUrl(IServiceDescriptor serviceDescriptor, string endpoint)
 {
     return(GetEndpointUrl(
                serviceDescriptor.Secured,
                serviceDescriptor.Server,
                serviceDescriptor.Port,
                serviceDescriptor.ServiceName,
                endpoint
                ));
 }
Exemplo n.º 12
0
 public static bool TryAdd([NotNull] this IServiceCollection collection,
                           [NotNull] IServiceDescriptor descriptor)
 {
     if (!collection.Any(d => d.ServiceType == descriptor.ServiceType))
     {
         collection.Add(descriptor);
         return(true);
     }
     return(false);
 }
Exemplo n.º 13
0
        /// <inheritdoc />
        public bool HasService(Type serviceType)
        {
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }

            IServiceDescriptor descriptor = registry.Services.GetByServiceType(serviceType);

            return(descriptor != null && !descriptor.IsDisabled);
        }
Exemplo n.º 14
0
 private void VerifyServiceTraitsType(IServiceDescriptor service, ref bool success)
 {
     try
     {
         service.ResolveTraitsType();
     }
     catch (Exception ex)
     {
         success = false;
         dispatchLogger.Log(LogSeverity.Error, "Unresolvable service traits type.", ex);
     }
 }
Exemplo n.º 15
0
        private void RegisterBuiltInComponent(IPluginDescriptor builtInPluginDescriptor,
                                              string serviceId, Type serviceType, object component)
        {
            IServiceDescriptor serviceDescriptor = registry.RegisterService(
                new ServiceRegistration(builtInPluginDescriptor, serviceId, new TypeName(serviceType)));

            registry.RegisterComponent(
                new ComponentRegistration(builtInPluginDescriptor, serviceDescriptor, serviceId, new TypeName(component.GetType()))
            {
                ComponentHandlerFactory = new InstanceHandlerFactory(component)
            });
        }
Exemplo n.º 16
0
        private void RegisterEventHandlerProxy(Type interfaceType, IPluginDescriptor plugin,
                                               IServiceDescriptor serviceDescriptor, string componentId)
        {
            var proxyType = typeof(EventHandlerProxy <>).MakeGenericType(interfaceType.GetGenericArguments());
            var typeName  = new TypeName(proxyType).ConvertToPartialAssemblyName();

            var componentRegistration = new ComponentRegistration(plugin, serviceDescriptor,
                                                                  Guid.NewGuid().ToString(), typeName);

            componentRegistration.ComponentProperties.Add("target", string.Format("${{{0}}}", componentId));

            registry.RegisterComponent(componentRegistration);
        }
Exemplo n.º 17
0
        public IServiceDescriptor[] GetServiceDescriptors <T>()
        {
            var serviceType = typeof(T);

            IServiceDescriptor[] descriptors;

            if (!TypeMap.TryGetValue(serviceType, out descriptors))
            {
                descriptors = new IServiceDescriptor[0];
            }

            return(descriptors);
        }
Exemplo n.º 18
0
        private static ConstructorInfo GetConstructorInfo(IServiceDescriptor serviceDescriptor)
        {
            var ctor =
                serviceDescriptor.ImplementationType.GetConstructors().FirstOrDefault() ??
                serviceDescriptor.ImplementationType.GetConstructor(Type.EmptyTypes);

            if (ctor == null)
            {
                throw new ArgumentException(
                          $"No constructor was found for type {serviceDescriptor.ImplementationType}");
            }

            return(ctor);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Discovers all of the available installer types for a given service.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <returns>
        /// An array of zero-or-more non-abstract installer types.
        /// </returns>
        public static Type[] DiscoverInstallerTypes(IServiceDescriptor service)
        {
            if (s_ServiceInstallerTypes == null)
            {
                s_ServiceInstallerTypes = TypeMeta.DiscoverImplementations <ZenjectServiceInstaller>();
            }

            var genericInstallerType = typeof(ZenjectServiceInstaller <>).MakeGenericType(service.ServiceType);

            return(s_ServiceInstallerTypes
                   .Where(installerType => genericInstallerType.IsAssignableFrom(installerType))
                   .Where(installerType => !installerType.IsAbstract && installerType.IsClass)
                   .ToArray());
        }
        private ServiceEntry CreateServiceEntry(IServiceDescriptor service)
        {
            var entry = new ServiceEntry();

            entry.Title      = service.Title;
            entry.Descriptor = service;
            entry.AvailableInstallerTypes = ZenjectServiceInstaller.DiscoverInstallerTypes(service);

            entry.InheritedInstallers = this.targetConfigurationObject.InheritedInstallers
                                        .Where(x => x.TargetService == service)
                                        .ToArray();

            this.targetInstallerComponents.TryGetValue(service, out entry.Installer);
            entry.InstallerActive           = entry.Installer != null && this.targetActiveInstallers.Contains(entry.Installer);
            entry.ClosestInheritedInstaller = this.targetConfigurationObject.FindClosestInheritedInstallerForService(service);

            entry.TargetInstaller = (entry.ClosestInheritedInstaller != null && !entry.InstallerActive)
                ? entry.ClosestInheritedInstaller
                : entry.Installer;

            if (entry.TargetInstaller != null)
            {
                entry.TargetInstallerTitle = NicifyNamespaceQualifiedInstallerTitle(entry.TargetInstaller.GetType());
            }

            entry.DominantInstaller = this.targetConfigurationObject.FindDominantInstallerForService(service);

            if (entry.TargetInstaller != null)
            {
                string targetInstallerHint = NicifyInstallerTitle(entry.TargetInstaller.GetType());
                if (targetInstallerHint.StartsWith(entry.Title))
                {
                    targetInstallerHint = targetInstallerHint.Substring(entry.Title.Length).TrimStart(' ', '-');
                }
                if (!string.IsNullOrEmpty(targetInstallerHint))
                {
                    if (EditorGUIUtility.isProSkin)
                    {
                        entry.Title += " <color=white>(" + targetInstallerHint + ")</color>";
                    }
                    else
                    {
                        entry.Title += " <color=grey>(" + targetInstallerHint + ")</color>";
                    }
                }
            }

            return(entry);
        }
Exemplo n.º 21
0
        private void RegisterComponent(Type interfaceType, string componentId, TypeName typeName,
                                       IPluginDescriptor plugin, IServiceDescriptor serviceDescriptor)
        {
            ComponentRegistration componentRegistration;

            if (IsAnEventHandler(interfaceType))
            {
                componentRegistration = RegisterEventHandlerProxy(interfaceType, plugin,
                                                                  serviceDescriptor, componentId);
            }
            else
            {
                componentRegistration = new ComponentRegistration(plugin, serviceDescriptor,
                                                                  componentId, typeName);
            }
            registry.RegisterComponent(componentRegistration);
        }
        public void TryAddWithEnumerableReturnsTrueIfAnyAdded()
        {
            // Arrange
            var collection = new ServiceCollection();

            // Act
            var ds = new IServiceDescriptor[] {
                new ServiceDescriber().Transient <IFakeService, FakeService>(),
                new ServiceDescriber().Transient <IFakeService, FakeService>()
            };

            // Assert
            Assert.True(collection.TryAdd(ds));
            var descriptor = Assert.Single(collection);

            Assert.Equal(typeof(IFakeService), descriptor.ServiceType);
            Assert.Null(descriptor.ImplementationInstance);
            Assert.Equal(LifecycleKind.Transient, descriptor.Lifecycle);
        }
Exemplo n.º 23
0
        internal OperationDescriptor(MethodInfo method, string operationName, IServiceDescriptor serviceDescriptor)
        {
            Extensions        = new Dictionary <string, object>(StringComparer.InvariantCultureIgnoreCase);
            Method            = method;
            ParameterNames    = method.GetParameters().Select(p => p.Name).ToArray();
            OperationName     = operationName;
            ServiceDescriptor = serviceDescriptor;
            Executor          = method.GetFunc();
            NameSelector      = method.GetAttribute <OperationNameSelectorAttribute>(true);
            MethodSelector    = method.GetAttribute <OperationSelectorAttribute>(true);
            Filters           = method.GetAttributes <OperationFilterAttribute>(true).Distinct().ToArray();
            Bindings          = method.GetParameters().Select(p => new BindingInfo(p)).ToArray();

            var descAttr = Method.GetAttribute <DescriptionAttribute>(true);

            if (descAttr != null)
            {
                Description = descAttr.Description;
            }
        }
Exemplo n.º 24
0
        public static void Register(this IUnityContainer container, IServiceDescriptor serviceDescriptor)
        {
            LifetimeManager lifetimeManager = null;
            switch (serviceDescriptor.Lifecycle)
            {
                case LifecycleKind.Singleton:
                    lifetimeManager = new ContainerControlledLifetimeManager();
                    break;
                case LifecycleKind.Scoped:
                    lifetimeManager = new HierarchicalLifetimeManager();
                    break;
                case LifecycleKind.Transient:
                    lifetimeManager = new TransientLifetimeManager();
                    break;
            }

            if (serviceDescriptor.ImplementationInstance != null)
                container.RegisterInstance(serviceDescriptor.ServiceType, serviceDescriptor.ImplementationInstance);
            else
                container.RegisterType(serviceDescriptor.ServiceType, serviceDescriptor.ImplementationType, lifetimeManager);
        }
Exemplo n.º 25
0
        private void BuildDependencyTree(IServiceDescriptor serviceDescriptor, Node <IServiceDescriptor> rootNode)
        {
            var ctor = GetConstructorInfo(serviceDescriptor);

            foreach (var param in ctor.GetParameters())
            {
                var type = param.ParameterType;
                if (type.IsSupportedCtorParam())
                {
                    var node =
                        new Node <IServiceDescriptor>
                    {
                        ParentNode = rootNode,
                        Data       = _typeRegistrations.Get(type)
                    };
                    rootNode.ChildNodes.Add(node);

                    BuildDependencyTree(_typeRegistrations.Get(type), node);
                }
            }
        }
Exemplo n.º 26
0
        protected virtual void RegisterToPeerContext(Channel channel, long priority, IServiceDescriptor serviceDescriptor)
        {
            if (channel == null)
            {
                ThrowHelper.ThrowArgumentNullException("channel");
            }

            Forge.Net.TerraGraf.NetworkManager.Instance.Localhost.PeerContextLock.Lock();
            try
            {
                NetworkPeerDataContext context = Forge.Net.TerraGraf.NetworkManager.Instance.Localhost.PeerContext;
                if (context == null)
                {
                    context = new NetworkPeerDataContext();
                }

                PropertyItem root = new PropertyItem(Id, string.Format("{0};{1}", channel.ServerEndpoints.ToList <AddressEndPoint>()[0].Port.ToString(), priority.ToString()));
                if (serviceDescriptor != null)
                {
                    Dictionary <string, PropertyItem> items = serviceDescriptor.CreateServiceProperty();
                    if (items != null)
                    {
                        foreach (KeyValuePair <string, PropertyItem> kv in items)
                        {
                            root.PropertyItems.Add(kv.Key, kv.Value);
                        }
                    }
                }
                context.PropertyItems[Id] = root;
                Forge.Net.TerraGraf.NetworkManager.Instance.Localhost.PeerContext = context;
            }
            finally
            {
                Forge.Net.TerraGraf.NetworkManager.Instance.Localhost.PeerContextLock.Unlock();
            }
        }
Exemplo n.º 27
0
 public ServiceResolvedContext(IServiceDescriptor serviceDescriptor, IServiceRequest req, IServiceResponse resp)
 {
     ServiceDescriptor = serviceDescriptor;
     Request = req;
     Response = resp;
 }
Exemplo n.º 28
0
        public virtual ManagerStateEnum Start(long priority, IServiceDescriptor serviceDescriptor)
        {
            if (this.ManagerState != ManagerStateEnum.Started)
            {
                if (priority < 0)
                {
                    ThrowHelper.ThrowArgumentOutOfRangeException("priority");
                }

                if (LOGGER.IsInfoEnabled)
                {
                    LOGGER.Info(string.Format("{0}, initializing service...", LOG_PREFIX));
                }

                OnStart(ManagerEventStateEnum.Before);

                try
                {
                    ChannelServices.Initialize();

                    this.ChannelId = ConfigurationAccessHelper.GetValueByPath(NetworkServiceConfiguration.Settings.CategoryPropertyItems, string.Format("Services/{0}", Id));
                    if (string.IsNullOrEmpty(this.ChannelId))
                    {
                        this.ChannelId = Id;
                    }

                    Channel channel = LookUpChannel();

                    if (channel.ServerEndpoints.Count == 0)
                    {
                        throw new InvalidConfigurationException(string.Format("Channel '{0}' has not got listening server endpoint(s).", channel.ChannelId));
                    }

                    ServiceBaseServices.Initialize();
                    if (!ServiceBaseServices.IsContractRegistered(typeof(TIServiceProxyType)))
                    {
                        ServiceBaseServices.RegisterContract(typeof(TIServiceProxyType), typeof(TServiceProxyImplementationType));
                    }

                    this.mPriority          = priority;
                    this.mServiceDescriptor = serviceDescriptor;

                    RegisterToPeerContext(channel, priority, serviceDescriptor);

                    this.ManagerState = ManagerStateEnum.Started;

                    if (LOGGER.IsInfoEnabled)
                    {
                        LOGGER.Info(string.Format("{0}, service successfully initialized.", LOG_PREFIX));
                    }
                }
                catch (Exception)
                {
                    this.ManagerState = ManagerStateEnum.Fault;
                    throw;
                }

                OnStart(ManagerEventStateEnum.After);
            }
            return(this.ManagerState);
        }
Exemplo n.º 29
0
 public GenericService(IServiceDescriptor descriptor)
 {
     _descriptor = descriptor;
 }
Exemplo n.º 30
0
 public InstanceService(IServiceDescriptor descriptor)
 {
     _descriptor = descriptor;
 }
Exemplo n.º 31
0
 private static long CalculateHash(IServiceDescriptor descriptor)
 {
     return ((((long)descriptor.Lifecycle * 397)
              ^ descriptor.ServiceType.GetHashCode()) * 397)
            ^ (descriptor.ImplementationInstance ?? descriptor.ImplementationType).GetHashCode();
 }
 public IServiceCollection Add(IServiceDescriptor descriptor)
 {
     _descriptors.Add(descriptor);
     return this;
 }
Exemplo n.º 33
0
 public CreateInstanceCallSite(IServiceDescriptor descriptor)
 {
     _descriptor = descriptor;
 }
 public IComponentDescriptor RegisterDisabledComponent(IServiceDescriptor service, string componentId, Type componentType)
 {
     var component = RegisterComponent(service, componentId, componentType);
     component.Plugin.Disable("Disabled component.");
     return component;
 }
 public IComponentDescriptor RegisterComponent(IServiceDescriptor service, string componentId, Type componentType)
 {
     var plugin = RegisterPlugin(service.Plugin);
     var component = RegisterComponent(new ComponentRegistration(plugin, service, componentId, new TypeName(componentType)));
     return component;
 }
 public ServiceDetailsTreeModel(IServiceDescriptor serviceDescriptor)
 {
     this.serviceDescriptor = serviceDescriptor;
 }
Exemplo n.º 37
0
 private void VerifyServiceType(IServiceDescriptor service, ref bool success)
 {
     try
     {
         service.ResolveServiceType();
     }
     catch (Exception ex)
     {
         success = false;
         dispatchLogger.Log(LogSeverity.Error, "Unresolvable service type.", ex);
     }
 }
 public ServiceDetailsTreeModel(IServiceDescriptor serviceDescriptor)
 {
     this.serviceDescriptor = serviceDescriptor;
 }
Exemplo n.º 39
0
        private static ComponentRegistration RegisterEventHandlerProxy(Type interfaceType, IPluginDescriptor plugin,
            IServiceDescriptor serviceDescriptor, string componentId)
        {
            var proxyType = typeof(EventHandlerProxy<>).MakeGenericType(interfaceType.GetGenericArguments());
            var typeName = new TypeName(proxyType).ConvertToPartialAssemblyName();

            var componentRegistration = new ComponentRegistration(plugin, serviceDescriptor,
                Guid.NewGuid().ToString(), typeName);

            componentRegistration.ComponentProperties.Add("target", string.Format("${{{0}}}", componentId));

            return componentRegistration;
        }
Exemplo n.º 40
0
        internal OperationDescriptor(MethodInfo method, string operationName, IServiceDescriptor serviceDescriptor)
        {
            Extensions = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
            Method = method;
            ParameterNames = method.GetParameters().Select(p => p.Name).ToArray();
            OperationName = operationName;
            ServiceDescriptor = serviceDescriptor;
            Executor = method.GetFunc();
            NameSelector = method.GetAttribute<OperationNameSelectorAttribute>(true);
            MethodSelector = method.GetAttribute<OperationSelectorAttribute>(true);
            Filters = method.GetAttributes<OperationFilterAttribute>(true).Distinct().ToArray();
            Bindings = method.GetParameters().Select(p => new BindingInfo( p)).ToArray();

            var descAttr = Method.GetAttribute<DescriptionAttribute>(true);
            if (descAttr != null)
                Description = descAttr.Description;
        }
 /// <inheritdoc />
 public IServiceCollection Add([NotNull] IServiceDescriptor descriptor)
 {
     _descriptors.Add(descriptor);
     return(this);
 }
        private void RegisterComponent(string componentId, TypeName typeName, IPluginDescriptor plugin, 
            IServiceDescriptor serviceDescriptor)
        {
            var componentRegistration = new ComponentRegistration(plugin, serviceDescriptor, 
                componentId, typeName);

            registry.RegisterComponent(componentRegistration);
        }
Exemplo n.º 43
0
 public Service(IServiceDescriptor descriptor)
 {
     _descriptor = descriptor;
 }
Exemplo n.º 44
0
 //TODO:
 public void OnServiceDescriptorResolved(IServiceDescriptor serviceDescriptor)
 {
     var errorNavigation = serviceDescriptor.ServiceType.GetAttribute<RedirectToErrorAttribute>(true);
     if (errorNavigation != null)
         serviceDescriptor.Extensions[ControllerListener.ErrorNavigation] = errorNavigation;
 }
Exemplo n.º 45
0
 private void RegisterComponent(Type interfaceType, string componentId, TypeName typeName,
     IPluginDescriptor plugin, IServiceDescriptor serviceDescriptor)
 {
     ComponentRegistration componentRegistration;
     if (IsAnEventHandler(interfaceType))
     {
         componentRegistration = RegisterEventHandlerProxy(interfaceType, plugin,
             serviceDescriptor, componentId);
     }
     else
     {
         componentRegistration = new ComponentRegistration(plugin, serviceDescriptor,
             componentId, typeName);
     }
     registry.RegisterComponent(componentRegistration);
 }
Exemplo n.º 46
0
 public FactoryService(IServiceDescriptor descriptor)
 {
     _descriptor = descriptor;
 }