Exemplo n.º 1
0
        /**
         * Build regular properties clause like:
         * {name:'name', release:20}
         */
        private static string BuildPropertyClause <T>(Meta meta, T entity)
        {
            var builder = new StringBuilder();

            builder.Append('{');

            foreach (var prop in meta.RegularProperties)
            {
                var value = prop.GetValue(entity);
                if (value != null)
                {
                    builder.AppendFormat("{0}:{1},", prop.GetName(), ConverterHelper.GetQueryString(value));
                }
            }

            builder.Remove(builder.Length - 1, 1);
            builder.Append('}');
            return(builder.ToString());
        }
Exemplo n.º 2
0
        private static string GetSingleClause(Criteria c, string defaultQueryKey)
        {
            if (c.IsEmpty)
            {
                return(string.Empty);
            }

            if (c.Value == null)
            {
                throw new Neo4JException("Value of criteria is null");
            }

            c.QueryKey ??= defaultQueryKey;
            var valStr = ConverterHelper.GetQueryString(c.Value);

            if (c.Property.Equals(Criteria.ID))
            {
                return($"{c.Property}({c.QueryKey}) {c.Operator.GetSymbol()} {valStr}");
            }

            return($"{c.QueryKey}.{c.Property} {c.Operator.GetSymbol()} {valStr}");
        }