Closed skuami closed 3 years ago
All the transformations need to be done consistently, so that the type names match. For example, see how "Foo"
is appended in multiple transformers.
services.AddHandlebarsTransformers(
entityNameTransformer: n => n + "Foo",
entityFileNameTransformer: n => n + "Foo",
constructorTransformer: e => new EntityPropertyInfo(e.PropertyType + "Foo", e.PropertyName + "Foo"),
propertyTransformer: e => new EntityPropertyInfo(e.PropertyType, e.PropertyName + "Foo"),
navPropertyTransformer: e => new EntityPropertyInfo(e.PropertyType + "Foo", e.PropertyName + "Foo"));
@skuami Did you find my answer helpful? Do you require further assistance with this issue? If not, I will close.
@tonysneed Thanks for your answer. I couldn't solve the problem yet. I am dependend on the open PR with additional information for navPropertyTransform. I will close this question as soon as I could solve it, ok?
@tonysneed As I mentioned on the open PR - the additional NavigationDetail information helping me to solve my problem. I hope the PR can be merged anytime soon. I am using code from the PR for now.
In a project I have a translation table and many other tables with one or more columns to be translated. Those tables are joined through a TranslationKey. The TranslationKey has on each table (not the translation table) a unique index. On the translation table is the primary key constructed with the combination of TranslationKey and LanguageCode.
Since the tables are not joined through the primary key - EF will generate "funny" names for the navigation properties. I posted this question also on Stackoverflow.
I tried to use the navPropertyTransformer. There are to little information in the EntityPropertyInfo to generate a new name for tables with multiple translations. Apart from that I am having also following issue (not sure if it is a bug or if I am doing something wrong):
The nav property gets renamed correctly but the initialization in the constructor gets not renamed:
Here's the transformation code I am using: