Open Closed

ApplicationService Lazy Properties are null in everytime #35


User avatar
0
talhazengin created

Hi,

We encountering null reference problem when using lazy CurrentTenant, CurrentUser or other lazy properties.

But when we inject them through constructor as like ICurrentTenant there is no problem.

Are we missing a simple thing?

Thanks.


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @talhazengin

    Please share some code, what I see from the picture is not particularly clear.

    Property injection will work after the constructor is executed.

  • User Avatar
    0
    talhazengin created

    Sorry for the picture. You are right, there is no problem after constructor executed. But the string localizer "L" property does not works as expected. It does not gets our resources. What can be the problem? Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Maybe LocalizationResource can solve your problem.

    see https://github.com/abpframework/abp/blob/654eeede81a733382066bfd00ab19b6b65ceec0e/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookManagementAppService.cs#L10

  • User Avatar
    0
    talhazengin created

    You are so much right, i thank you, all the best wishes.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11