Initial commit
This commit is contained in:
31
FarmmapsApiSamples/Program.cs
Normal file
31
FarmmapsApiSamples/Program.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user