public static void SetRouteParameters <TParameters, T>(
            IIndexTypePath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
            where T : class
        {
            var inferrer = new ElasticInferrer(settings);

            if (path.Index == null)
            {
                path.Index = inferrer.IndexName <T>();
            }

            if (path.Type == null)
            {
                path.Type = inferrer.TypeName <T>();
            }

            var index = inferrer.IndexName(path.Index);
            var type  = inferrer.TypeName(path.Type);

            pathInfo.Index = index;
            pathInfo.Type  = type;
        }
Beispiel #2
0
        public static void SetRouteParameters <TParameters>(
            IIndexTypePath <TParameters> path,
            IConnectionSettingsValues settings,
            ElasticsearchPathInfo <TParameters> pathInfo)
            where TParameters : IRequestParameters, new()
        {
            var inferrer = new ElasticInferrer(settings);

            if (path.Index == null)
            {
                if (path.Type != null && path.Type.Type != null)
                {
                    path.Index = path.Type.Type;
                }
                else
                {
                    throw new DslException("Index() not specified");
                }
            }

            if (path.Type == null)
            {
                throw new DslException("Type() not specified");
            }

            var index = inferrer.IndexName(path.Index);
            var type  = inferrer.TypeName(path.Type);

            pathInfo.Index = index;
            pathInfo.Type  = type;
        }