TryBindServiceType() публичный статический Метод

public static TryBindServiceType ( Service service, IEnumerable configuredOpenGenericServices, Type openGenericImplementationType, Type &constructedImplementationType, IEnumerable &constructedServices ) : bool
service Revenj.Extensibility.Autofac.Core.Service
configuredOpenGenericServices IEnumerable
openGenericImplementationType System.Type
constructedImplementationType System.Type
constructedServices IEnumerable
Результат bool
        public IEnumerable <IComponentRegistration> RegistrationsFor(Service service, Func <Service, IEnumerable <IComponentRegistration> > registrationAccessor)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }
            if (registrationAccessor == null)
            {
                throw new ArgumentNullException("registrationAccessor");
            }

            Type constructedImplementationType;
            IEnumerable <Service> services;

            if (OpenGenericServiceBinder.TryBindServiceType(service, _registrationData.Services, _activatorData.ImplementationType, out constructedImplementationType, out services))
            {
                var swt         = (IServiceWithType)service;
                var fromService = _activatorData.FromService.ChangeType(swt.ServiceType);

                return(registrationAccessor(fromService)
                       .Select(cr => RegistrationBuilder.CreateRegistration(
                                   Guid.NewGuid(),
                                   _registrationData,
                                   new ReflectionActivator(
                                       constructedImplementationType,
                                       _activatorData.ConstructorFinder,
                                       _activatorData.ConstructorSelector,
                                       AddDecoratedComponentParameter(swt.ServiceType, cr, _activatorData.ConfiguredParameters),
                                       _activatorData.ConfiguredProperties),
                                   services)));
            }

            return(Enumerable.Empty <IComponentRegistration>());
        }
        public IEnumerable <IComponentRegistration> RegistrationsFor(Service service, Func <Service, IEnumerable <IComponentRegistration> > registrationAccessor)
        {
            if (service == null)
            {
                throw new ArgumentNullException("service");
            }
            if (registrationAccessor == null)
            {
                throw new ArgumentNullException("registrationAccessor");
            }

            Type constructedImplementationType;
            IEnumerable <Service> services;

            if (OpenGenericServiceBinder.TryBindServiceType(service, _registrationData.Services, _activatorData.ImplementationType, out constructedImplementationType, out services))
            {
                yield return(RegistrationBuilder.CreateRegistration(
                                 Guid.NewGuid(),
                                 _registrationData,
                                 new ReflectionActivator(
                                     constructedImplementationType,
                                     _activatorData.ConstructorFinder,
                                     _activatorData.ConstructorSelector,
                                     _activatorData.ConfiguredParameters,
                                     _activatorData.ConfiguredProperties),
                                 services));
            }
        }