Faking dynamic rel types

One of the things I've seen requested (as far back as version 2.x I think), that is planned to come in GQL 10, is being able to use variables for rel names.
Something like:

UNWIND ['rel1', 'rel2'] as dynamicType
MATCH (n)-[:$dynamicType]->(m)

We've been faking this for a while and I figured I'd share our pattern.
Our primary app is in C# and uses the awesome .NET Bolt Driver. We're also not able to use APOC (so if this is possible with APOC, that's why we have an alternative).

We've standardized using string replacement to manage it.

var year = 2010;
string cypher = "MATCH (n)-[:OWNED_IN_##Year##]->(m) RETURN n,m";
cypher.Replace("##Year##", yr);
using (var session = driver.Session(AccessMode.Read)){
  session.ReadTransaction(tx => tx.Run(cypher));

It misses on being able to use caching but typically if it's a long running process for us, it's called numerous times, in a batch (which is something apoc will do) so does take advantage of it usually.

This is a very simple implementation but can be very complex. For example, we have a process that stores approx 60 different complex rules as cypher in the graph, are pulled out and looped through being placed in a query WHERE clause.

SIDE BAR: If anyone wants tips on formatting regex from c# -> cypher -> java let me know, I've got some ;)

Mike French