Reputation: 291
Visual Studio already has T4 templates to generate the iCRUD pages for the various Razor pages, but these are built around the input of the domain models.
I would like something similar, except input a ViewModel (to start with, all properties are from a single domain model). Default to using AutoMapper or choose to individually map the Domain Model properties to the ViewModel properties.
For instance, I have a Person domain model with 30+ properties. For a simple company phone book lookup, all I need are a few properties. If I could create a ViewModel that had only these properties and used a T4 template to create the Index (list) razor pages, that would be done. Then if the Powers That Be decided they wanted another property; Boom! change the ViewModel, regenerate the Razor page and be done.
This would make minor change requests easy, allow easy prevention of overposting, allow quick-and-dirty changes be done by others, elimination of possible spelling errors, etc.
If I was (much) smarter, I am quite sure the existing templates could be easily modified to handle this.
I was wondering if this was something already created.
thank you for your time. chuck
Upvotes: 0
Views: 274