The code below works fine for primitive expressions (no surprise there)
public class SiteContextExpressionBuilder : ExpressionBuilder {
public override CodeExpression GetCodeExpression(BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context) {
PropertyInfo property = typeof(SiteContext).GetProperty(entry.Expression);
return new CodePrimitiveExpression(property.GetValue(null, null)));
}
}
Now I would like to return non primitive types as well. Let's say a Company object.
How does that work? I can't seem to find any good examples.
Invalid Primitive Type: ... Consider using CodeObjectCreateExpression
How do I implement the CodeObjectCreateExpression or alternative?