forked from FarmMaps/FarmMapsApiClient
31 lines
966 B
C#
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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|