44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using AS1024.GeoFeed.Core.Interfaces;
|
|
using AS1024.GeoFeed.Core.GeoFeedPreloader;
|
|
using AS1024.GeoFeed.Core.GeoFeedProviders;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using AS1024.GeoFeed.Core.GeoFeedSqliteLocalCache;
|
|
using AS1024.GeoFeed.Core.CacheService;
|
|
|
|
namespace AS1024.GeoFeed
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddHostedService<PreLoadGeoFeed>();
|
|
builder.Services.AddTransient<IGeoFeedProvider, NetBoxGeoFeedProvider>();
|
|
builder.Services.AddDbContext<GeoFeedCacheDbContext>(
|
|
options =>
|
|
{
|
|
options.UseSqlite(builder.Configuration.GetConnectionString("LocalFeedCache"));
|
|
});
|
|
builder.Services.AddScoped<IGeoFeedPersistentCacheProvider, GeoFeedSqliteCache>();
|
|
builder.Services.AddHostedService<GeoFeedCacheService>();
|
|
builder.Services.AddHttpClient();
|
|
builder.Services.AddMemoryCache();
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddControllers();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|
|
}
|
|
}
|
|
}
|