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
How do I replace the built-in IHostingEnvironment service?
IHostingEnvironment
Umbraco registers this to be AspNetCoreHostingEnvironment using
AspNetCoreHostingEnvironment
builder.Services.AddUnique<IHostingEnvironment, AspNetCoreHostingEnvironment>(); // Umbraco.Web.Common\DependencyInjection\UmbracoBuilderExtensions.cs
but I would like to replace this service with my own.
I'm not sure how or where to do this.
It seems this composer hack works:
public void Compose(IUmbracoBuilder builder) { var hostingEnvironmentServices = builder.Services.Where(service => service.ServiceType == typeof(IHostingEnvironment)).ToList(); foreach (var hostingEnvironmentService in hostingEnvironmentServices) builder.Services.Remove(hostingEnvironmentService); builder.Services.AddUnique< IHostingEnvironment, MyHostingEnvironment>(); }
Surely there's a better way?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Replacing IHostingEnvironment
How do I replace the built-in
IHostingEnvironment
service?Umbraco registers this to be
AspNetCoreHostingEnvironment
usingbut I would like to replace this service with my own.
I'm not sure how or where to do this.
It seems this composer hack works:
Surely there's a better way?
is working on a reply...