Suggestion to facilitate service inheritance.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
один год назад
Hello NopCommerce team and thank you for your job.

I am developing a plugin for NopCommerce 4.50 to generate invoices fully compliant with French (and maybe European) laws, for example for the eco-participation "tax" and for numbering.
For this I inherited from PdfService and it works. But all PdfService attributes (_addressSettings, _catalogSettings,...) are private, so I have to redeclare them in my class and this is redundant code. I don't like redundant code. ;-)
It might not be a bad idea to make them protected in a future release . No ?

Have a nice day.
один год назад
Thanks. Already done.
один год назад
All those private readonly fields are the 'backing' fields for the dependency injection.
Consider that the  PdfService is a partial class.  I.e.,  you probably should not be inheriting from it but rather extending it.
один год назад
Thank you for your answers.

@RomanovM: In the code I have, V4.50, PdfService attributes are always Private. Also in other services, for example AddressService.

@New York: Yes, I saw that PdfService is a partial class. But as I change the whole layout I found it easier to inherit from PdfService.

But my remark is not very important. If I collapse the Fields region this bloated code doesn't bother me anymore ;-)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.