Open Closed

How to read ExtraProperties from db #3628


User avatar
0
bunyamin.avci created
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no

We want to add an extra property to the users module of ABP.

We have done the necessary work for this and added extra properties in Json format.! Abp_case2.png

However, we cannot read these extra properties we added, We see null. We are having a problem in getting data from the database and printing them to the screen. What should we do?


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    we cannot read these extra properties we added,

    hi

    It will automatically read and set the properties of the entity, what is your code and steps?

  • User Avatar
    0
    bunyamin.avci created

    Hi,

    I worked on a little more. I get the return as in the image.

    I guess can i access subfields with a '.' after ExtraProperties? Or do I need to json.deserialize in a foreach?

    Thanks for your help.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    I guess can i access subfields with a '.' after ExtraProperties?

    I think you can do that. https://docs.abp.io/en/abp/latest/Object-Extensions#getproperty

  • User Avatar
    0
    bunyamin.avci created

    Oh, really quick answer. Thanks for your support. I'll try that. If i have got any problem, i'll write here.

  • User Avatar
    0
    maliming created
    Support Team

    : )

  • User Avatar
    0
    bunyamin.avci created

    Hi again :D,

    I used the GetProperty<string> method you specified in a method defined as GetAsync(Guid id) in an app service. It works, I can see the information. But I want to run it in a Task<PagedResultDto<AppUserDto>> GetListAsync(GetAppUsersInput input) method. I am sharing the image of the codes in this method here.

    I need to use these extra properties on angular side. Like this; I applied what is written in this document about it. https://docs.abp.io/en/abp/latest/Module-Entity-Extensions Codes:

    Client side:

    What we want to do is to bring the data in this extraProperties field to the relevant client page. This fetch fails.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Can you check the ajax response of GetListAsync in your angular app?

  • User Avatar
    0
    bunyamin.avci created

    Hi,

    When we trigger it via Swagger, we see null values as in the image. However, this data is available in the database. I have completed all the steps you specified. I also looked at the ajax responses in the Angular app.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Can you share a sample project? liming.ma@volosoft.com

Made with ❤️ on ABP v9.2.0-preview. Updated on January 20, 2025, 10:27