Can someone please tell me how to register a class so it can be injected because these docs aren't working for me at all. I think they are written for experts rather than people that want to learn, but I may be wrong:
https://docs.umbraco.com/umbraco-cms/reference/using-ioc
I have a static helper class I wish to inject into a surface controller to use it's methods but I think I need to register it first. So trying to work out from the docs how to do that and failing miserably. I'm happy with the concept of DI and can do it all day long with Umbraco services, but registering my own is the issue here.
Cobbling instructions together from the Vendr DI page I tried adding:-
services.AddTransient<Helpers>(); to ConfigureServices in startup.cs but that just gives me:
Unhandled exception. System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Web.Core.Services.Helpers Lifetime: Transient ImplementationType: Web.Core.Services.Helpers': Unable to resolve service for type 'Umbraco.Cms.Core.Models.PublishedContent.IPublishedContent' while attempting to activate 'Web.Core.Services.Helpers'.)
So I have:
Namespace: myProj.Core.Services
Class: Helpers (with various methods)
Then what?
Thanks.