Entity with polygon/polyline callback property

I am trying to create a polygon entity which has a polyline instead of outline property when positions are returned from callback property.
sandcastle example

I realised that this can be solved using 2 callback properties, first for polygon positions which return polygonHierarchy and second one for polyline positions which returns an array of positions (example). But I am afraid that it won’t be performance vice with a larger number of points. Or is there a way to render a polygon outline when only 2 points exist (dynamic drawing).
Thanks in advance