Closed MyEidos closed 5 years ago
The transformer methods are, as you point out, limited in terms of what metadata is communicated to the Handlebars template, namely, property name and type. The reason for this is simplicity and performance.
For scenarios where you need to take more control of the transformation process, it is recommended you create a class that extends HbsCSharpEntityTypeGenerator
and override GenerateProperties
. Then register your MyCSharpEntityTypeGenerator
in your ScaffoldingDesignTimeServices
class. See #61 for detailed instructions.
@MyEidos Have you tried the approach I suggested with extending HbsCSharpEntityTypeGenerator
? Does it allow you to achieve what you'd like to accomplish?
Closing this as resolved. @MyEidos Please let me know if this is not the case.
@tonysneed, could this be looked at again? Your proposal to extend HbsCSharpEntityTypeGenerator
doesn't work well because the base implementation of GenerateNavigationProperties
, for example, includes references to private members in the base class. Could you either make those references protected or, even more ideally, pass in the objects such as the INavigation
instance into the navPropertyTransformer?
Another idea (not mutally exclusive from the other ideas) would be to add calls to partial methods inside the methods that generate properties, nav properties, etc, so a sub class could extend the logic without having to recreate the existing logic - which would incur a risk of getting outdated if the original logic in the base class changes.
It is hard and sometimes not flexible to use propertyTransformer because of luck of information inside method. It will be great to have next information in propertyTransformer: