Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Cannot get CreatorUserName #840


User avatar
0
hole7 created

Hello,

Could anyone help me!

I'm trying to get CreatorUser of Comment Entity on Application service and bind it to Dto. I saw in the demo code of module-zero that in dto, we will declare a property CreatorUserName and config mapping for that dto and then in service we use .Include(). But it's not working.

Please see attached for more details. [http://pasteboard.co/1ZD86HW6.png])

Thanks & regards


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Your code seems correct. Can you check items in blogComments to see if their CreatorUser is not null and contains Name field as well.

    Since CreatorUserId is nullable, CreatorUser in your case might be null.

  • User Avatar
    0
    hole7 created

    Hi ismcagdas,

    Thanks for your response!

    I checked CreatorUser and its value is null. I don't know why because I can see value from database as image below

    [http://pasteboard.co/217Rxg5p.png])

    Thanks & regards, Ho Le

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If user with id 1 does not belong the same Tenant/Host with logged in user, you cannot see CreatorUserName. Can you confirm that, logged in user and user with id 1 belongs to same tenant or host.

    If this is not the case, then we will investigate further.

  • User Avatar
    0
    hole7 created

    Hi ismcagdas,

    As you said, I looked my code and you're right. That was my misunderstanding. I logged in with host user (generated with start-up template) but comment user was tenant admin user. Thanks for your great help. I think I have to take more time on Multi-Tenancy document.

    p/s: This framework is awesome. I really like it