Пример #1
0
        /// <inheritdoc />
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            UrlParser.Register <HttpUrlParser>();
            UrlParser.Register <FtpUrlParser>();
            WindsorComponentProvider componentProvider = container.Resolve <WindsorComponentProvider>();
            var  configuration      = (HttpConfigurationSection)ConfigurationManager.GetSection(HttpConfigurationSection.ConfigurationSection);
            Type sourceSelectorType = ((configuration != null) && (configuration.DefaultValueRelationSelectorType != null) ?
                                       configuration.DefaultValueRelationSelectorType :
                                       typeof(DefaultValueRelationSelector));

            container.AddFacility <TypedFactoryFacility>();
            var typedFactory = new UrsaCustomTypedFactory();

            container.Register(Component.For <IControllerActivator>().UsingFactoryMethod((kernel, context) => new DefaultControllerActivator(UrsaConfigurationSection.InitializeComponentProvider())).LifestyleSingleton());
            container.Register(Component.For <ITripleStore>().Instance(_tripleStore.Value).Named("InMemoryTripleStore").LifestyleSingleton());
            container.Register(Component.For <INamedGraphSelectorFactory>().AsFactory(typedFactory).LifestyleSingleton());
            container.Register(Component.For <INamedGraphSelector>().ImplementedBy <LocallyControlledOwningResourceNamedGraphSelector>()
                               .Forward <ILocallyControlledNamedGraphSelector>().Named("InMemoryNamedGraphSelector").LifestyleSingleton()
                               .PropertiesIgnore((model, property) => property == typeof(LocallyControlledOwningResourceNamedGraphSelector).GetProperty("CurrentRequest")));
            container.Register(Component.For <IEntityContextFactory>().Instance(_entityContextFactory.Value).Named("InMemoryEntityContextFactory").LifestyleSingleton());
            container.Register(Component.For <IEntityContext>().UsingFactoryMethod(CreateEntityContext).Named("InMemoryEntityContext").LifeStyle.HybridPerWebRequestPerThread());
            container.Register(Component.For <IEntityContextProvider>().AsFactory(typedFactory).LifestyleSingleton());
            container.Register(Component.For <IDefaultValueRelationSelector>().ImplementedBy(sourceSelectorType).LifestyleSingleton());
            container.Register(Component.For(typeof(DescriptionController <>)).Forward <IController>()
                               .ImplementedBy(typeof(DescriptionController <>), componentProvider.GenericImplementationMatchingStrategy).LifestyleTransient());
            container.Register(Component.For <EntryPointDescriptionController>().Forward <IController>().ImplementedBy <EntryPointDescriptionController>().LifestyleTransient());
            container.Register(Component.For <IParameterSourceArgumentBinder>().ImplementedBy <FromQueryStringArgumentBinder>().Activator <NonPublicComponentActivator>().LifestyleSingleton());
            container.Register(Component.For <IParameterSourceArgumentBinder>().ImplementedBy <FromUrlArgumentBinder>().Activator <NonPublicComponentActivator>().LifestyleSingleton());
            container.Register(Component.For <IParameterSourceArgumentBinder>().ImplementedBy <FromBodyArgumentBinder>().Activator <NonPublicComponentActivator>().LifestyleSingleton());
            container.Register(Component.For <IClassGenerator>().ImplementedBy <HydraClassGenerator>().LifestyleSingleton());
            container.Register(Component.For <IUriParser>().ImplementedBy <Web.Http.Description.CodeGen.GenericUriParser>().LifestyleSingleton());
            container.Register(Component.For <IUriParser>().ImplementedBy <HydraUriParser>().LifestyleSingleton().Named(typeof(HydraUriParser).FullName));
            container.Register(Component.For <IUriParser>().ImplementedBy <XsdUriParser>().LifestyleSingleton().Named(typeof(XsdUriParser).FullName));
            container.Register(Component.For <IUriParser>().ImplementedBy <OGuidUriParser>().LifestyleSingleton().Named(typeof(OGuidUriParser).FullName));
            container.Register(Component.For <IXmlDocProvider>().ImplementedBy <XmlDocProvider>().LifestyleSingleton());
            container.Register(Component.For <IWebRequestProvider>().ImplementedBy <WebRequestProvider>().LifestyleSingleton());
            container.Register(Component.For <IRequestHandler <RequestInfo, ResponseInfo> >().ImplementedBy <RequestHandler>().LifestyleSingleton());
            container.Register(Component.For <IResponseComposer>().ImplementedBy <ResponseComposer>().LifestyleSingleton());
            container.Register(Component.For <IDelegateMapper <RequestInfo> >().ImplementedBy <DelegateMapper>().LifestyleSingleton());
            container.Register(Component.For <IArgumentBinder <RequestInfo> >().ImplementedBy <ArgumentBinder>().LifestyleSingleton());
            container.Register(Component.For <IResultBinder <RequestInfo> >().ImplementedBy <ResultBinder>().LifestyleSingleton());
            container.Register(Component.For <ITypeDescriptionBuilder>().ImplementedBy <HydraCompliantTypeDescriptionBuilder>()
                               .Named(EntityConverter.Hydra.ToString()).IsDefault().LifestyleSingleton());
            container.Register(Component.For <IServerBehaviorAttributeVisitor>().ImplementedBy <DescriptionBuildingServerBahaviorAttributeVisitor <ParameterInfo> >().Named("Hydra"));
            container.Register(Component.For(typeof(IApiDescriptionBuilder <>)).ImplementedBy(typeof(ApiDescriptionBuilder <>)).LifestyleSingleton().Forward <IApiDescriptionBuilder>());
            container.Register(Component.For <IApiEntryPointDescriptionBuilder>().ImplementedBy <ApiEntryPointDescriptionBuilder>().LifestyleSingleton().Forward <IApiDescriptionBuilder>());
            container.Register(Component.For <IApiDescriptionBuilderFactory>().AsFactory(typedFactory).LifestyleSingleton());
            container.Register(Component.For <IModelTransformer>().ImplementedBy <CollectionModelTransformer>().LifestyleSingleton());
        }
 internal DefaultGenericImplementationMatchingStrategy(WindsorComponentProvider container)
 {
     _container = container;
 }
Пример #3
0
 internal DefaultGenericImplementationMatchingStrategy(WindsorComponentProvider container)
 {
     _container = container;
 }