Exemple #1
0
        private static ICypherFluentQuery MatchWorker <T>(this ICypherFluentQuery query, T entity, MatchOptions options, Func <ICypherFluentQuery, string, ICypherFluentQuery> matchFunction) where T : class
        {
            var     identifier  = entity.EntityParamKey(options.Identifier);
            var     matchCypher = entity.ToCypherString <T, CypherMatchAttribute>(CypherExtensionContext.Create(query), identifier, options.MatchOverride);
            var     cql         = string.Format("{0}({1}){2}", options.PreCql, matchCypher, options.PostCql);
            dynamic cutdown     = entity.CreateDynamic(options.MatchOverride ?? CypherTypeItemHelper.PropertiesForPurpose <T, CypherMatchAttribute>(entity));

            var matchKey = GetMatchParamName(identifier);

            return(matchFunction(query, cql)
                   .WithParam(matchKey, cutdown));
        }
        internal static string ToCypherString <TEntity, TAttr>(this TEntity entity, ICypherExtensionContext context, string paramKey = null, List <CypherProperty> useProperties = null)
            where TAttr : CypherExtensionAttribute
            where TEntity : class
        {
            var properties = useProperties ?? CypherTypeItemHelper.PropertiesForPurpose <TEntity, TAttr>(entity);

            return(entity.GetMatchCypher(context, properties, paramKey));
        }
Exemple #3
0
        private static List <CypherProperty> GetCreateProperties <T>(T entity, List <CypherProperty> onCreateOverride = null) where T : class
        {
            var properties = onCreateOverride ?? CypherTypeItemHelper.PropertiesForPurpose <T, CypherMergeOnCreateAttribute>(entity);

            return(properties);
        }