Inject the necessary services into the DI container

This commit is contained in:
Jeff Leung 2024-01-08 09:57:51 -08:00
parent e974635cfb
commit 37841db663
1 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,7 @@
using AS1024.GeoFeed.GeoFeedBuilder; using AS1024.GeoFeed.GeoFeedBuilder;
using AS1024.GeoFeed.GeoFeedLocalCache;
using AS1024.GeoFeed.Interfaces; using AS1024.GeoFeed.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace AS1024.GeoFeed namespace AS1024.GeoFeed
{ {
@ -11,6 +13,11 @@ namespace AS1024.GeoFeed
builder.Services.AddHostedService<PreLoadGeoFeed>(); builder.Services.AddHostedService<PreLoadGeoFeed>();
builder.Services.AddTransient<IGeoFeedProvider, NetBoxGeoFeedProvider>(); builder.Services.AddTransient<IGeoFeedProvider, NetBoxGeoFeedProvider>();
builder.Services.AddHostedService<GeoFeedCacheService>();
builder.Services.AddDbContext<GeoFeedCacheDbContext>(options =>
{
options.UseSqlite(builder.Configuration.GetConnectionString("LocalFeedCache"));
});
builder.Services.AddHttpClient(); builder.Services.AddHttpClient();
builder.Services.AddMemoryCache(); builder.Services.AddMemoryCache();
// Add services to the container. // Add services to the container.