Is there already a solution somewhere that allows to create a strongly typed model (using interfaces where needed) from a razor view?
Details :
We got a webservice that receives a json object, and a path to a template. It renders html using the template and the object using razor. And does various transformations to assure conformity and output the html.
When developping the clients, we'd like to have intellisense when binding data to the model. The current process is Dynamic=> Json=> Dynamic. What we'd like is Strongly typed=>Json=>Dynamic
The webservice is used by a lot of different services and teams. Views/Template are written by the comm department, we can't ask them to write classes.
Ideally what we'd like is to have a t4 template that generate model classes from razor views.
Any idea/hint is welcomed.
My guess so far was to try and painfully parse the razor file to generate an object tree, then analyze as best as I can the types (foreach requires IEnumerable, if theres an if(xxx) xxx is a bool etc).
Aucun commentaire:
Enregistrer un commentaire