FarmMapsApiClient/FarmmapsApiSamples/Program.cs
2020-03-24 09:47:08 +01:00

31 lines
966 B
C#

using System.Threading.Tasks;
using FarmmapsApi;
using FarmmapsApi.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace FarmmapsApiSamples
{
class Program
{
private static async Task Main(string[] args)
{
IConfiguration config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", false, true)
.Build();
var configuration = config.Get<Configuration>();
var serviceProvider = new ServiceCollection()
.AddLogging(opts => opts
.AddConsole()
.AddFilter("System.Net.Http", LogLevel.Warning))
.AddFarmmapsServices(configuration)
.AddSingleton<IApp, DefaultApp>()
.BuildServiceProvider();
await serviceProvider.GetService<IApp>().RunAsync();
}
}
}