示例#1
0
        internal FanoutQueryMessage Serialize()
        {
            while (m_selectFields.Count <= m_traverseActions.Count)
            {
                m_selectFields.Add(new List <string>());
            }

            QueryExpressionSecurityCheck();
            if (!m_generated_from_json_dsl)
            {
                EvaluateQueryParameters();
            }
            if (!m_generated_from_json_dsl && m_origin_query != null)
            {
                try
                {
                    JObject jobj = JsonConvert.DeserializeObject <JObject>(m_origin_query);
                    JsonDSL.ProcessJsonOriginNodeObject(this, jobj);
                    JsonDSL.ProcessJsonSelectField(m_selectFields.First(), jobj);
                }
                catch { throw new FanoutSearchQueryException("Invalid starting node query object"); }
            }

            List <string>         predicates = m_traverseActions.Select(pred => ExpressionSerializer.Serialize(pred)).ToList();
            List <List <string> > edge_types = m_edgeTypes.Select(_ => _.edge_types.ToList()).ToList();

            return(new FanoutQueryMessage((byte)m_traverseActions.Count, m_origin, m_origin_query, predicates, edge_types, m_selectFields, m_skipCount, m_takeCount));
        }