Service registration
In a default Umbraco installation all Enterspeed services will automatically be registered because of the call to .AddComposers()
in the ConfigureServices
method of the Startup
class.
public class Startup
{
...
public void ConfigureServices(IServiceCollection services)
{
services.AddUmbraco(_env, _config)
.AddBackOffice()
.AddWebsite()
.AddDeliveryApi()
.AddComposers()
.Build();
}
...
}
Manual registration
If you, for what ever reason, have removed the .AddComposers()
call and manually have registered the Umbraco services, you can register Enterspeed using the .AddEnterspeed()
method.
public class Startup
{
...
public void ConfigureServices(IServiceCollection services)
{
services.AddUmbraco(_env, _config)
.AddBackOffice()
.AddWebsite()
.AddDeliveryApi()
.AddEnterspeed()
.Build();
}
...
}
Custom service registrations
Sometimes you want to overwrite existing functionality with your own implementation. You can do that by implementing existing interfaces or overwrite existing classes and then register your new custom types. You do that by creating an Umbraco composer class - see example below. You can also read more about dependency injection in the Umbraco documentation
[ComposeAfter(typeof(EnterspeedComposer))]
public class CustomComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Services.AddUnique<IUmbracoRedirectsService, CustomUmbracoRedirectsService>(ServiceLifetime.Transient);
}
}