Documentation

Migrate from INomirunBootstrapable to NomirunModuleStartup

From Nomirun CLI version 1.15.0 and Nomirun Host version 1.5.0, Nomirun introduced the NomirunModuleStartup abstract class as a replacement for the INomirunBootstrapable interface.

The new approach is more flexible and allows you to register services in a more granular way and without unnecessary code.

This guide will help you migrate your existing extensions from INomirunBootstrapable to the new NomirunModuleStartup abstract class.

This is pre 1.15.0:

public class Startup: INomirunBootstrapable
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

    private IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        //Add customer service registration

        //Registration of Nomirun HTTP Client
        services.AddScoped<IHttpClientService, HttpClientService>();

        //Register Swagger documentation
        services.ConfigureSwaggerDocs();
    }
}

This is the new approach:

public class Startup : NomirunModuleStartup
{
    public Startup(IConfiguration configuration) : base(configuration)
    { }

    protected override void RegisterModuleServices(IServiceCollection services)
    {
        //Add customer service registration

    }
}
  • The services.AddScoped<IHttpClientService, HttpClientService>(); was removed as it is not used in the template project.
  • The services.ConfigureSwaggerDocs(); was removed as it’s registered automatically in the Nomirun Host.