GeoFeed/AS1024.GeoFeed/Program.cs

40 lines
1.1 KiB
C#

using AS1024.GeoFeed.GeoFeedBuilder;
using AS1024.GeoFeed.GeoFeedLocalCache;
using AS1024.GeoFeed.Interfaces;
using Microsoft.EntityFrameworkCore;
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.AddHostedService<GeoFeedCacheService>();
builder.Services.AddDbContext<GeoFeedCacheDbContext>(options =>
{
options.UseSqlite(builder.Configuration.GetConnectionString("LocalFeedCache"));
});
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();
}
}
}