There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Create Translator UI / Code Gen requests
The Create Translator tool is very useful. In our current project we are using a service -> controller model and as expected we are translating back and forth between the datacontract objects and our business entities. However, there are some challenges
which would make the process much easier.
1) If the types on the properties don't match, you either have to skip them or cancel. This is a bit of a burden if your object has > 5 or so properties and the last one is the one that, for example, should be nullable on the data contract, but isn't. Obviously,
one choice would be to finish the map as much as possible and generate the class. Since the tool doesn't allow you to re-generate a translator, the generated code file is ok to edit at that point. My suggestion would be either allow for re-generation of an
existing translator class or do some explicit casting in the generated code.
2) Type selection is slow and tedious. I appreciate the pop-up tool for selecting the type, but it would be nice to actually be able to just type in the class name without having to load up a UI for each one. Also, that button with the ellipses is a little
small and sometimes unresponsive.
3) One nifty little thing we did on our project, which was very helpful was to create a set ot translator extensions for each Translation map. For each direction of the translation, we have a Widget1.ToWidget2() extension for the singular object as well as
a List<Widget1>.ToWidget2() extension for the List<T> types. I dunno how helpful this will be to everyone, but it reduced the amount of code we had to write in each service method dramatically. I have attached an example snippet below that generates
the translation extension for us.