Closed Simply007 closed 1 year ago
I reviewed the code and from my perspective we cover all existing scenarios
DeliveryClientFactory.Create
method is used only in obsolete NamedDeliveryClientFactory
. I wouldn't change anything there, as we don't recommend to use this approach anymoreDeliveryClient
https://github.com/kontent-ai/delivery-sdk-net/blob/master/docs/configuration/dependency-injection.md
2.1 using DI - we can register ILoggerFactory
using services.AddSingleton<IloggerFactory, YourLoggerFactory>()
2.2 using DeliveryClientBuilder
- we can use WithLoggerFactory()
methodDeliveryClientCache
, we also have 2 possibilities to do it - https://github.com/kontent-ai/delivery-sdk-net/blob/master/docs/retrieving-data/caching.md
3.1 using DI. The approach is the same as above - we should add ILoggerFactory
implemetation to DI
3.2 we can create CacheManager
using CacheManagerFactory.Create
method, which has optional loggerFactory
parameterAddMultipleDeliveryClientFactory
method - https://github.com/kontent-ai/delivery-sdk-net/blob/master/docs/configuration/multiple-delivery-clients.md
4.1 we can create regular DeliveryClient
using AddDeliveryClient
method. It has optionalConfig
delegat parameter and we can call WithLoggerFactory
method there. Each registered DeliveryClient
will have its own ILoggerFactory
implementation
4.2 DeliveryClientCache
can be added using AddDeliveryClientCache
method. We can register ILoggerFactory
implemetation for whole DeliveryClientCache
the same as it described in 4.1. Nevertheless, due to the fact that CacheManager
instance is created using CacheManagerFactory.Create
method, it's necessary to register ILoggerFactory
instance to CacheManager
separately using its optional parameter loggerFactory
. It doesn't seem to be the best solution, but this is the price for CacheManager
is created directly without DI's usage.Thx - so we can close this issue.
Brief bug description
Related to #358
Repro steps
i.e.
DeliveryClientFactory.Create
is missing these optionsExpected behavior
ILoggerFactory
.ILoggerfactory
should be expected to be provided by the IOC container at least onIDeliveryClient
level