I'm trying to upgrade the my Kentico Cloud SDK from v7 to v10. Before I was just creating a new instance of the DeliveryClient to build a service of my site's urls to resolve and then pass that to my CustomContentLinkUrlResolver e.g.
services.AddSingleton<NavigationProvider>(c => new NavigationProvider(new DeliveryClient(deliveryOptions) {
CodeFirstModelProvider = { TypeProvider = new CustomTypeProvider() }
}, cache));
services.AddSingleton<IDeliveryClient>(c => new CachedDeliveryClient(projectOptions, cache)
{
CodeFirstModelProvider = { TypeProvider = new CustomTypeProvider() },
ContentLinkUrlResolver = new CustomContentLinkUrlResolver(c.GetRequiredService<NavigationProvider>())
});
So I have this circular dependency where the DeliveryClient depends on the CustomContentLinkUrlResolver which depends on the DeliveryClient.
The frustrating part is the ResolveLinkUrl(ContentLink link) method doesn't have the information I need to resolve urls, because the urls are defined by the taxonomy of an item which is unavailable in ContentLink which means I have to do another lookup of the item to get the taxonomy.
I don't know how to get around CustomContentLinkUrlResolver having a dependency on DeliveryClient.