Skip to content

Don't overload Statup.cs with our ConfigureServices #5

@tossnet

Description

@tossnet

It seems cleaner to place our dependencies in a separate file so as not to overload the Statup.cs file.

Like this :

 public void ConfigureServices(IServiceCollection services)
 {
    // ... 
   DependenciesConfig.Configure(services, Configuration);
 }

DependenciesConfig.cs :

public static class DependenciesConfig
{
        public static void Configure(IServiceCollection services, IConfiguration configuration)
        {
            services.AddTransient<ILoginService, LoginService>();

            services.AddScoped<AuthenticationStateProvider, CustomAuthenticationStateProvider>();

            services.AddHttpClient<IConnexionService, ConnexionService>();
            services.AddHttpClient<IUserService, UserService>();
          //...
        }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions