Moved registering services to separated class

This commit is contained in:
2024-08-13 17:53:22 +03:00
parent cc7eb1d168
commit a77a8339d7
4 changed files with 27 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
using System.Reflection;
namespace SchengenVisaApi
{
/// Provides methods to add services to DI-container
public static class DependencyInjection
{
/// Add needed services
public static IServiceCollection RegisterServices(this IServiceCollection services)
{
services.AddControllers();
services.AddEndpointsApiExplorer();
services.AddSwaggerGen(options =>
{
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});
return services;
}
}
}