1
0
mirror of https://github.com/XFox111/MuiCharts.git synced 2026-04-22 06:51:05 +03:00

- Reworked Infrastructure injection

- Added LettuceEncrypt for HTTPS
- Fixed DataContext
- Moved connection string to appsettings.json
This commit is contained in:
2024-02-22 14:56:15 +00:00
parent be8cc7ded4
commit 39bc85c9d9
7 changed files with 38 additions and 23 deletions
@@ -1,6 +1,9 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using MuiCharts.Domain.Repositories;
using MuiCharts.Infrastructure.Repositories;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration;
namespace MuiCharts.Infrastructure;
@@ -14,12 +17,16 @@ public static class InfrastructrureExtensions
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
/// <returns>The modified <see cref="IServiceCollection"/>.</returns>
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
public static void AddInfrastructure(this IHostApplicationBuilder builder)
{
services.AddDbContext<DataContext>();
services.AddScoped<IPointRepository, PointRepository>();
services.AddScoped<ITrackRepository, TrackRepository>();
builder.Services.AddDbContext<DataContext>(options =>
{
options
.UseSqlite(builder.Configuration.GetConnectionString(nameof(DataContext)))
.EnableSensitiveDataLogging(builder.Environment.IsDevelopment());
});
return services;
builder.Services.AddScoped<IPointRepository, PointRepository>();
builder.Services.AddScoped<ITrackRepository, TrackRepository>();
}
}