Hi, is it possible to extend/add extra properties to 'LanguageText' entity, when it does not have 'ExtendedProperty' property?
4 Answer(s)
-
0
Why do you need to extend LanguageText? Can you share a use-case so I can suggest to you an alternative way.
LanguageText is a simple type and mostly you don't need to customize or extend it. Extending that entity is useless. Because there is no data stored in the database until you override from UI. All data is stored in localization .json files. Even if you could extend, you'll not be able to store data until override a LanguageText.
Still, I can suggest to you something else when you shared a use-case.
-
0
Thank you for your reply. I said the same to our business people, but they want to have 2 extra properties: Notes & Description in LanguageText entity, so when they need to change any localized text, they'd know where it is used on the site and what it for. I'd go in this case with defining new entity, which would derive from LanguageText & IHasExtraProperty interface and then map it to LanguageText table, but would like to see your suggestion.
Thanks!
-
0
I don't suggest to replace entire entity because of maintainability issues. Upgrading newer versions of ABP & LanguageManagement will be tough. Also when you create a new entity, you'll lost Replace DbContext Feature,
ILanguageManagementDbContext
won't be able to be replaced and you can't join any of data from ILanguageManagementDbContext. Also you might get a problem on AppService and mappings.In that case, I suggest you to create a new entity with one to one relation with LanguageText entity and store extra datas in that table. You can even join with two table via using Replace DbContext Feature. Then provide new data over a new endpoint with new dto.
-
0
Thank you again. Those are the good points against extending entity. I like your suggestion and we're will follow it.