| | | 1 | | using Microsoft.Extensions.DependencyInjection; |
| | | 2 | | |
| | | 3 | | namespace NLightning.Infrastructure.Repositories; |
| | | 4 | | |
| | | 5 | | using Domain.Bitcoin.Interfaces; |
| | | 6 | | using Domain.Channels.Interfaces; |
| | | 7 | | using Domain.Persistence.Interfaces; |
| | | 8 | | using Memory; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Extension methods for setting up Persistence infrastructure services in an IServiceCollection. |
| | | 12 | | /// </summary> |
| | | 13 | | public static class DependencyInjection |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Adds Bitcoin infrastructure services to the specified IServiceCollection. |
| | | 17 | | /// </summary> |
| | | 18 | | /// <param name="services">The IServiceCollection to add services to.</param> |
| | | 19 | | /// <returns>The same service collection so that multiple calls can be chained.</returns> |
| | | 20 | | public static IServiceCollection AddRepositoriesInfrastructureServices(this IServiceCollection services) |
| | 0 | 21 | | { |
| | | 22 | | // Register UnitOfWork |
| | 0 | 23 | | services.AddScoped<IUnitOfWork, UnitOfWork>(); |
| | | 24 | | |
| | | 25 | | // Register memory repositories |
| | 0 | 26 | | services.AddSingleton<IChannelMemoryRepository, ChannelMemoryRepository>(); |
| | 0 | 27 | | services.AddSingleton<IUtxoMemoryRepository, UtxoMemoryRepository>(); |
| | | 28 | | |
| | 0 | 29 | | return services; |
| | 0 | 30 | | } |
| | | 31 | | } |