Circular Dependencies
public class SiteService : ISiteService
{
private readonly Lazy<IUmbracoContextFactory> _umbracoContextFactory;
public SiteService(Lazy<IUmbracoContextFactory> umbracoContextFactory)
{
_umbracoContextFactory = umbracoContextFactory;
}
public IPublishedContent GetNewsSection()
{
using (UmbracoContextReference umbracoContextReference = _umbracoContextFactory.Value.EnsureUmbracoContext())
{
// Do your thing
}
}
}Last updated
Was this helpful?