Add a cache system on the referential info

+ Add an identity service
This commit is contained in:
Sébastien André
2021-04-17 22:17:45 +02:00
parent 0bb9ed2a30
commit 143127cd01
30 changed files with 955 additions and 570 deletions

View File

@@ -1,17 +1,18 @@
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using skydiveLogs_api.DomainBusiness;
using skydiveLogs_api.DomainBusiness.Interfaces;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure;
using skydiveLogs_api.DomainBusiness.Interfaces;
using skydiveLogs_api.DomainBusiness;
using skydiveLogs_api.Infrastructure.Interfaces;
namespace skydiveLogs_api.Ioc
{
public class IocService
{
#region Public Constructors
public IocService(IServiceCollection services,
IConfiguration configuration)
{
@@ -19,6 +20,10 @@ namespace skydiveLogs_api.Ioc
_configuration = configuration;
}
#endregion Public Constructors
#region Public Methods
public void Configure()
{
_services.AddScoped<IAircraftService, AircraftService>();
@@ -31,6 +36,10 @@ namespace skydiveLogs_api.Ioc
_services.AddScoped<IUserImageService, UserImageService>();
_services.AddScoped<IInitDbService, InitDbService>();
_services.AddSingleton<ICacheService, CacheService>();
_services.AddScoped<IIdentityService, IdentityService>();
_services.AddScoped(s => s.GetService<IHttpContextAccessor>()?.HttpContext.User);
_services.AddScoped<IAircraftRepository, AircraftRepository>();
_services.AddScoped<IDropZoneRepository, DropZoneRepository>();
_services.AddScoped<IJumpRepository, JumpRepository>();
@@ -39,13 +48,18 @@ namespace skydiveLogs_api.Ioc
_services.AddScoped<IUserRepository, UserRepository>();
_services.AddScoped<IUserImageRepository, UserImageRepository>();
_services.AddScoped<IFavoriteDropZoneRepository, FavoriteDropZoneRepository>();
string connectionString = _configuration.GetConnectionString("DefaultConnection");
_services.AddSingleton<IDataProvider>(c => new LiteDbProvider(connectionString));
}
private readonly IServiceCollection _services;
#endregion Public Methods
#region Private Fields
private readonly IConfiguration _configuration;
private readonly IServiceCollection _services;
#endregion Private Fields
}
}
}

View File

@@ -5,6 +5,10 @@
<RootNamespace>skydiveLogs_api.Ioc</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\skydiveLogs-api.Infrastructure\skydiveLogs-api.Infrastructure.csproj" />
<ProjectReference Include="..\skydiveLogs-api.DomainBusiness\skydiveLogs-api.DomainBusiness.csproj" />