private static Type GetCoreDocumentType(ISolrServer server)
        {
            var documentType = server.DocumentType;

            if (string.IsNullOrEmpty(documentType))
            {
                throw new RegistrationException("Document type missing in SolrNet core configuration");
            }

            Type type;

            try
            {
                type = Type.GetType(documentType);
            }
            catch (Exception e)
            {
                throw new RegistrationException(string.Format("Error getting document type '{0}'", documentType), e);
            }

            if (type == null)
            {
                throw new RegistrationException(string.Format("Error getting document type '{0}'", documentType));
            }

            return(type);
        }
        protected virtual Type GetCoreDocumentType(ISolrServer server)
        {
            var documentType = server.DocumentType;

            if (string.IsNullOrEmpty(documentType))
            {
                throw new StructureMapConfigurationException("Document type missing in SolrNet core configuration");
            }

            Type type;

            try
            {
                type = Type.GetType(documentType);
            }
            catch (Exception e)
            {
                throw new StructureMapConfigurationException($"Error getting document type '{documentType}'", e);
            }

            if (type == null)
            {
                throw new StructureMapConfigurationException($"Error getting document type '{documentType}'");
            }

            return(type);
        }
        private static SolrCore GetCore(ISolrServer server)
        {
            var id           = server.Id ?? Guid.NewGuid().ToString();
            var documentType = GetCoreDocumentType(server);
            var coreUrl      = GetCoreUrl(server);

            UriValidator.ValidateHTTP(coreUrl);
            return(new SolrCore(id, documentType, coreUrl));
        }
        private static string GetCoreUrl(ISolrServer server)
        {
            var url = server.Url;

            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException("Core url missing in SolrNet core configuration");
            }
            return(url);
        }
Example #5
0
        private static string GetCoreUrl(ISolrServer server)
        {
            var url = server.Url;

            if (string.IsNullOrEmpty(url))
            {
                throw new StructureMapConfigurationException("Core url missing in SolrNet core configuration"); // ConfigurationErrorsException("Core url missing in SolrNet core configuration");
            }
            return(url);
        }
        protected virtual string GetCoreUrl(ISolrServer server)
        {
            var url = server.Url;

            if (string.IsNullOrEmpty(url))
            {
                throw new StructureMapConfigurationException("Core url missing in SolrNet core configuration");
            }

            UriValidator.ValidateHTTP(url);
            return(url);
        }