Skip to content

Instantly share code, notes, and snippets.

@bwatts
Created September 19, 2014 04:32
Show Gist options
  • Save bwatts/27fcc995177402920ebe to your computer and use it in GitHub Desktop.
Save bwatts/27fcc995177402920ebe to your computer and use it in GitHub Desktop.
public abstract class JsonbExpressionVisitor : ExpressionVisitor
{
protected override Expression VisitExtension(Expression node)
{
var jsonbNode = node as JsonbExpression;
return jsonbNode == null ? node : VisitJsonb(jsonbNode);
}
protected virtual Expression VisitJsonb(JsonbExpression node)
{
switch(node.JsonbType)
{
case JsonbType.Type1:
return VisitJsonbType1((JsonbType1) node);
case JsonbType.Type2:
return VisitJsonbType2((JsonbType2) node);
default:
return node;
}
}
protected virtual Expression VisitJsonbType1(JsonbType1 node)
{
// Visit node parts
}
protected virtual Expression VisitJsonbType2(JsonbType2 node)
{
// Visit node parts
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment