I am wondering how can I define a routing map like this:
{TreePath}/{Action}{Id}
TreeMap is dynamically loaded from a database like this:<
You can have the "greedy" part within the querystring as long as you can have fixed parts after it, e.g.
/{*TreePath}/Edit/{id}
/{*TreePath}/Action/{id}
Note that the action is not variable in the above routes because the greedy parts needs to stop at some literal value (other that forward slash). I will work if you only perform a few actions on your "tree" but will cumbersome if you have many action since each will need its own route entry.
It will not work out of the box but requires a custom route. You can find a nice write on the subject including code here