Open Closed

ApplicationService Lazy Properties are null in everytime #35


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)
  • 0
    maliming created

    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.

  • 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.

  • 0
    maliming created

    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

  • 0
    talhazengin created

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