private void RegisterCore(SolrCore core, IUnityContainer container) {
     string connectionId = GetCoreConnectionId(core.Id);
     container.RegisterType<ISolrConnection, SolrConnection>(connectionId, new InjectionConstructor(core.Url));
     if (!container.IsRegistered(typeof (ISolrOperations<>).MakeGenericType(core.DocumentType))) {
         RegisterAll(core, container, isNamed : false);
     }
     RegisterAll(core, container);
 }
        private void RegisterCore(SolrCore core, IUnityContainer container)
        {
            string connectionId = GetCoreConnectionId(core.Id);

            container.RegisterType <ISolrConnection, SolrConnection>(connectionId, new InjectionConstructor(core.Url));
            if (!container.IsRegistered(typeof(ISolrOperations <>).MakeGenericType(core.DocumentType)))
            {
                RegisterAll(core, container, isNamed: false);
            }
            RegisterAll(core, container);
        }
        private static void RegisterSolrOperations(SolrCore core, IUnityContainer container, bool isNamed = true)
        {
            var ISolrReadOnlyOperations = typeof(ISolrReadOnlyOperations <>).MakeGenericType(core.DocumentType);
            var ISolrBasicOperations    = typeof(ISolrBasicOperations <>).MakeGenericType(core.DocumentType);
            var ISolrOperations         = typeof(ISolrOperations <>).MakeGenericType(core.DocumentType);
            var SolrServer           = typeof(SolrServer <>).MakeGenericType(core.DocumentType);
            var registrationId       = isNamed ? core.Id : null;
            var injectionConstructor = new InjectionConstructor(
                new ResolvedParameter(ISolrBasicOperations, registrationId),
                new ResolvedParameter(typeof(IReadOnlyMappingManager)),
                new ResolvedParameter(typeof(IMappingValidator)));

            container.RegisterType(ISolrOperations, SolrServer, registrationId, injectionConstructor);
            container.RegisterType(ISolrReadOnlyOperations, SolrServer, registrationId, injectionConstructor);
        }
        private static void RegisterSolrQueryExecuter(SolrCore core, IUnityContainer container, bool isNamed = true)
        {
            var    ISolrQueryExecuter = typeof(ISolrQueryExecuter <>).MakeGenericType(core.DocumentType);
            var    SolrQueryExecuter  = typeof(SolrQueryExecuter <>).MakeGenericType(core.DocumentType);
            string coreConnectionId   = GetCoreConnectionId(core.Id);
            var    registrationId     = isNamed ? core.Id : null;

            container.RegisterType(
                ISolrQueryExecuter, SolrQueryExecuter, registrationId,
                new InjectionConstructor(
                    new ResolvedParameter(typeof(ISolrAbstractResponseParser <>).MakeGenericType(core.DocumentType)),
                    new ResolvedParameter(typeof(ISolrConnection), coreConnectionId),
                    new ResolvedParameter(typeof(ISolrQuerySerializer)),
                    new ResolvedParameter(typeof(ISolrFacetQuerySerializer)),
                    new ResolvedParameter(typeof(ISolrMoreLikeThisHandlerQueryResultsParser <>).MakeGenericType(core.DocumentType))));
        }
Ejemplo n.º 5
0
        private void RegisterCore(SolrCore core, IUnityContainer container)
        {
            string connectionId = GetCoreConnectionId(core.Id, core.HttpMethod);

            if (core.HttpMethod.Equals("POST"))
            {
                container.RegisterType <ISolrConnection, PostSolrConnection>(connectionId, new InjectionConstructor(new SolrConnection(core.Url), core.Url));
            }
            else
            {
                container.RegisterType <ISolrConnection, SolrConnection>(connectionId, new InjectionConstructor(core.Url));
            }

            if (!container.IsRegistered(typeof(ISolrOperations <>).MakeGenericType(core.DocumentType)))
            {
                RegisterAll(core, container, isNamed: false);
            }
            RegisterAll(core, container);
        }
        private static void RegisterBasicOperations(SolrCore core, IUnityContainer container, bool isNamed = true)
        {
            var    ISolrBasicReadOnlyOperations = typeof(ISolrBasicReadOnlyOperations <>).MakeGenericType(core.DocumentType);
            var    SolrBasicServer      = typeof(SolrBasicServer <>).MakeGenericType(core.DocumentType);
            var    ISolrBasicOperations = typeof(ISolrBasicOperations <>).MakeGenericType(core.DocumentType);
            var    ISolrQueryExecuter   = typeof(ISolrQueryExecuter <>).MakeGenericType(core.DocumentType);
            var    registrationId       = isNamed ? core.Id : null;
            string coreConnectionId     = GetCoreConnectionId(core.Id);

            var injectionParameters = new InjectionConstructor(
                new ResolvedParameter(typeof(ISolrConnection), coreConnectionId),
                new ResolvedParameter(ISolrQueryExecuter, registrationId),
                new ResolvedParameter(typeof(ISolrDocumentSerializer <>).MakeGenericType(core.DocumentType)),
                new ResolvedParameter(typeof(ISolrSchemaParser)),
                new ResolvedParameter(typeof(ISolrHeaderResponseParser)),
                new ResolvedParameter(typeof(ISolrQuerySerializer)),
                new ResolvedParameter(typeof(ISolrDIHStatusParser)),
                new ResolvedParameter(typeof(ISolrExtractResponseParser)));

            container.RegisterType(ISolrBasicOperations, SolrBasicServer, registrationId, injectionParameters);
            container.RegisterType(ISolrBasicReadOnlyOperations, SolrBasicServer, registrationId, injectionParameters);
        }
 private static void RegisterAll(SolrCore core, IUnityContainer container, bool isNamed = true)
 {
     RegisterSolrQueryExecuter(core, container, isNamed);
     RegisterBasicOperations(core, container, isNamed);
     RegisterSolrOperations(core, container, isNamed);
 }
 private static void RegisterSolrOperations(SolrCore core, IUnityContainer container, bool isNamed = true) {
     var ISolrReadOnlyOperations = typeof (ISolrReadOnlyOperations<>).MakeGenericType(core.DocumentType);
     var ISolrBasicOperations = typeof (ISolrBasicOperations<>).MakeGenericType(core.DocumentType);
     var ISolrOperations = typeof (ISolrOperations<>).MakeGenericType(core.DocumentType);
     var SolrServer = typeof (SolrServer<>).MakeGenericType(core.DocumentType);
     var registrationId = isNamed ? core.Id : null;
     var injectionConstructor = new InjectionConstructor(
         new ResolvedParameter(ISolrBasicOperations, registrationId),
         new ResolvedParameter(typeof (IReadOnlyMappingManager)),
         new ResolvedParameter(typeof (IMappingValidator)));
     container.RegisterType(ISolrOperations, SolrServer, registrationId, injectionConstructor);
     container.RegisterType(ISolrReadOnlyOperations, SolrServer, registrationId, injectionConstructor);
 }
 private static void RegisterAll(SolrCore core, IUnityContainer container, bool isNamed = true) {
     RegisterSolrQueryExecuter(core, container, isNamed);
     RegisterBasicOperations(core, container, isNamed);
     RegisterSolrOperations(core, container, isNamed);
 }
Ejemplo n.º 10
0
 private static void RegisterSolrQueryExecuter(SolrCore core, IUnityContainer container, bool isNamed = true) {
     var ISolrQueryExecuter = typeof (ISolrQueryExecuter<>).MakeGenericType(core.DocumentType);
     var SolrQueryExecuter = typeof (SolrQueryExecuter<>).MakeGenericType(core.DocumentType);
     string coreConnectionId = GetCoreConnectionId(core.Id);
     var registrationId = isNamed ? core.Id : null;
     container.RegisterType(
         ISolrQueryExecuter, SolrQueryExecuter, registrationId,
         new InjectionConstructor(
             new ResolvedParameter(typeof (ISolrAbstractResponseParser<>).MakeGenericType(core.DocumentType)),
             new ResolvedParameter(typeof (ISolrConnection), coreConnectionId),
             new ResolvedParameter(typeof (ISolrQuerySerializer)),
             new ResolvedParameter(typeof (ISolrFacetQuerySerializer)),
             new ResolvedParameter(typeof (ISolrMoreLikeThisHandlerQueryResultsParser<>).MakeGenericType(core.DocumentType))));
 }
Ejemplo n.º 11
0
        private static void RegisterBasicOperations(SolrCore core, IUnityContainer container, bool isNamed = true) {
            var ISolrBasicReadOnlyOperations = typeof (ISolrBasicReadOnlyOperations<>).MakeGenericType(core.DocumentType);
            var SolrBasicServer = typeof (SolrBasicServer<>).MakeGenericType(core.DocumentType);
            var ISolrBasicOperations = typeof (ISolrBasicOperations<>).MakeGenericType(core.DocumentType);
            var ISolrQueryExecuter = typeof (ISolrQueryExecuter<>).MakeGenericType(core.DocumentType);
            var registrationId = isNamed ? core.Id : null;
            string coreConnectionId = GetCoreConnectionId(core.Id);

            var injectionParameters = new InjectionConstructor(
               new ResolvedParameter(typeof(ISolrConnection), coreConnectionId),
               new ResolvedParameter(ISolrQueryExecuter, registrationId),
               new ResolvedParameter(typeof(ISolrDocumentSerializer<>).MakeGenericType(core.DocumentType)),
               new ResolvedParameter(typeof(ISolrSchemaParser)),
               new ResolvedParameter(typeof(ISolrHeaderResponseParser)),
               new ResolvedParameter(typeof(ISolrQuerySerializer)),
               new ResolvedParameter(typeof(ISolrDIHStatusParser)),
               new ResolvedParameter(typeof(ISolrExtractResponseParser)));

            container.RegisterType(ISolrBasicOperations, SolrBasicServer, registrationId, injectionParameters);
            container.RegisterType(ISolrBasicReadOnlyOperations, SolrBasicServer, registrationId, injectionParameters);
        }
        private void RegisterCore(SolrCore core, IUnityContainer container)
        {
            var coreConnectionId = core.Id + typeof (SolrConnection);

              container.RegisterType<ISolrConnection, SolrConnection>(coreConnectionId, new InjectionConstructor(core.Url));

              var ISolrQueryExecuter = typeof (ISolrQueryExecuter<>).MakeGenericType(core.DocumentType);
              var SolrQueryExecuter = typeof (SolrQueryExecuter<>).MakeGenericType(core.DocumentType);

              container.RegisterType(
            ISolrQueryExecuter, SolrQueryExecuter,
            new InjectionConstructor(
            new ResolvedParameter(typeof(ISolrAbstractResponseParser<>).MakeGenericType(core.DocumentType)),
              new ResolvedParameter(typeof (ISolrConnection), coreConnectionId),
              new ResolvedParameter(typeof (ISolrQuerySerializer)),
              new ResolvedParameter(typeof (ISolrFacetQuerySerializer)),
              new ResolvedParameter(typeof (ISolrMoreLikeThisHandlerQueryResultsParser<>).MakeGenericType(core.DocumentType))));

              var ISolrBasicOperations = typeof (ISolrBasicOperations<>).MakeGenericType(core.DocumentType);
              var ISolrBasicReadOnlyOperations = typeof (ISolrBasicReadOnlyOperations<>).MakeGenericType(core.DocumentType);
              var SolrBasicServer = typeof (SolrBasicServer<>).MakeGenericType(core.DocumentType);

              container.RegisterType(
            ISolrBasicOperations, SolrBasicServer,
            new InjectionConstructor(
              new ResolvedParameter(typeof (ISolrConnection), coreConnectionId),
              new ResolvedParameter(ISolrQueryExecuter),
              new ResolvedParameter(typeof (ISolrDocumentSerializer<>).MakeGenericType(core.DocumentType)),
              new ResolvedParameter(typeof (ISolrSchemaParser)),
              new ResolvedParameter(typeof (ISolrHeaderResponseParser)),
              new ResolvedParameter(typeof (ISolrQuerySerializer)),
              new ResolvedParameter(typeof (ISolrDIHStatusParser)),
              new ResolvedParameter(typeof (ISolrExtractResponseParser))));

              container.RegisterType(
            ISolrBasicReadOnlyOperations, SolrBasicServer,
            new InjectionConstructor(
              new ResolvedParameter(typeof (ISolrConnection), coreConnectionId),
              new ResolvedParameter(ISolrQueryExecuter),
              new ResolvedParameter(typeof (ISolrDocumentSerializer<>).MakeGenericType(core.DocumentType)),
              new ResolvedParameter(typeof (ISolrSchemaParser)),
              new ResolvedParameter(typeof (ISolrHeaderResponseParser)),
              new ResolvedParameter(typeof (ISolrQuerySerializer)),
              new ResolvedParameter(typeof (ISolrDIHStatusParser)),
              new ResolvedParameter(typeof (ISolrExtractResponseParser))));

              var ISolrOperations = typeof (ISolrOperations<>).MakeGenericType(core.DocumentType);
              var SolrServer = typeof (SolrServer<>).MakeGenericType(core.DocumentType);

              container.RegisterType(
            ISolrOperations, SolrServer,
            new InjectionConstructor(
              new ResolvedParameter(ISolrBasicOperations),
              new ResolvedParameter(typeof (IReadOnlyMappingManager)),
              new ResolvedParameter(typeof (IMappingValidator))));

              var ISolrReadOnlyOperations = typeof (ISolrReadOnlyOperations<>).MakeGenericType(core.DocumentType);

              container.RegisterType(
            ISolrReadOnlyOperations, SolrServer,
            new InjectionConstructor(
              new ResolvedParameter(ISolrBasicOperations),
              new ResolvedParameter(typeof (IReadOnlyMappingManager)),
              new ResolvedParameter(typeof (IMappingValidator))));
        }
Ejemplo n.º 13
0
        private void RegisterCore(SolrCore core, IUnityContainer container)
        {
            var coreConnectionId = core.Id + typeof(SolrConnection);

            container.RegisterType <ISolrConnection, SolrConnection>(coreConnectionId, new InjectionConstructor(core.Url));

            var ISolrQueryExecuter = typeof(ISolrQueryExecuter <>).MakeGenericType(core.DocumentType);
            var SolrQueryExecuter  = typeof(SolrQueryExecuter <>).MakeGenericType(core.DocumentType);

            container.RegisterType(
                ISolrQueryExecuter, SolrQueryExecuter,
                new InjectionConstructor(
                    new ResolvedParameter(typeof(ISolrQueryResultParser <>).MakeGenericType(core.DocumentType)),
                    new ResolvedParameter(typeof(ISolrConnection), coreConnectionId),
                    new ResolvedParameter(typeof(ISolrQuerySerializer)),
                    new ResolvedParameter(typeof(ISolrFacetQuerySerializer)),
                    new ResolvedParameter(typeof(ISolrMoreLikeThisHandlerQueryResultsParser <>).MakeGenericType(core.DocumentType))));

            var ISolrBasicOperations         = typeof(ISolrBasicOperations <>).MakeGenericType(core.DocumentType);
            var ISolrBasicReadOnlyOperations = typeof(ISolrBasicReadOnlyOperations <>).MakeGenericType(core.DocumentType);
            var SolrBasicServer = typeof(SolrBasicServer <>).MakeGenericType(core.DocumentType);

            container.RegisterType(
                ISolrBasicOperations, SolrBasicServer,
                new InjectionConstructor(
                    new ResolvedParameter(typeof(ISolrConnection), coreConnectionId),
                    new ResolvedParameter(ISolrQueryExecuter),
                    new ResolvedParameter(typeof(ISolrDocumentSerializer <>).MakeGenericType(core.DocumentType)),
                    new ResolvedParameter(typeof(ISolrSchemaParser)),
                    new ResolvedParameter(typeof(ISolrHeaderResponseParser)),
                    new ResolvedParameter(typeof(ISolrQuerySerializer)),
                    new ResolvedParameter(typeof(ISolrDIHStatusParser)),
                    new ResolvedParameter(typeof(ISolrExtractResponseParser))));

            container.RegisterType(
                ISolrBasicReadOnlyOperations, SolrBasicServer,
                new InjectionConstructor(
                    new ResolvedParameter(typeof(ISolrConnection), coreConnectionId),
                    new ResolvedParameter(ISolrQueryExecuter),
                    new ResolvedParameter(typeof(ISolrDocumentSerializer <>).MakeGenericType(core.DocumentType)),
                    new ResolvedParameter(typeof(ISolrSchemaParser)),
                    new ResolvedParameter(typeof(ISolrHeaderResponseParser)),
                    new ResolvedParameter(typeof(ISolrQuerySerializer)),
                    new ResolvedParameter(typeof(ISolrDIHStatusParser)),
                    new ResolvedParameter(typeof(ISolrExtractResponseParser))));

            var ISolrOperations = typeof(ISolrOperations <>).MakeGenericType(core.DocumentType);
            var SolrServer      = typeof(SolrServer <>).MakeGenericType(core.DocumentType);

            container.RegisterType(
                ISolrOperations, SolrServer,
                new InjectionConstructor(
                    new ResolvedParameter(ISolrBasicOperations),
                    new ResolvedParameter(typeof(IReadOnlyMappingManager)),
                    new ResolvedParameter(typeof(IMappingValidator))));

            var ISolrReadOnlyOperations = typeof(ISolrReadOnlyOperations <>).MakeGenericType(core.DocumentType);

            container.RegisterType(
                ISolrReadOnlyOperations, SolrServer,
                new InjectionConstructor(
                    new ResolvedParameter(ISolrBasicOperations),
                    new ResolvedParameter(typeof(IReadOnlyMappingManager)),
                    new ResolvedParameter(typeof(IMappingValidator))));
        }