Starts in:
2 DAYS
4 HRS
25 MIN
35 SEC
Starts in:
2 D
4 H
25 M
35 S
Open Closed

Extending LanguageText entity #2221


User avatar
0
korolei created

Hi, is it possible to extend/add extra properties to 'LanguageText' entity, when it does not have 'ExtendedProperty' property?


4 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    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.

  • User Avatar
    0
    korolei created

    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!

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    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, ILanguageManagementDbContextwon'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.

  • User Avatar
    0
    korolei created

    Thank you again. Those are the good points against extending entity. I like your suggestion and we're will follow it.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06