Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi guys
I'm using Umbraco 13 and created my own Interface.
Part of the derived class is injecting UmbracoHelper into the constructor.
When I try and use it across my application, I received the error
'cannot consume scoped service Umbraco. CMS.web.common.umbracohelper'
How could I use it inject Umbraco Helper into my classes/interfaces and register them properly?
you could maybe try instantiating it rather than using DI
var accessor = StaticServiceProvider.Instance.GetRequiredService<IUmbracoHelperAccessor>(); if (accessor.TryGetUmbracoHelper(out var umbracoHelper)) { return umbracoHelper.Content(id); }
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
How to use UmbracoHelper in an Interface?
Hi guys
I'm using Umbraco 13 and created my own Interface.
Part of the derived class is injecting UmbracoHelper into the constructor.
When I try and use it across my application, I received the error
'cannot consume scoped service Umbraco. CMS.web.common.umbracohelper'
How could I use it inject Umbraco Helper into my classes/interfaces and register them properly?
you could maybe try instantiating it rather than using DI
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.