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...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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...