34 lines
861 B
C#
34 lines
861 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using NDB.Infrastructure.PublicIP;
|
|
using NDB.Infrastructure.PublicIP.Services;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NDB.Testing.App
|
|
{
|
|
class Program
|
|
{
|
|
static async Task Main(string[] args)
|
|
{
|
|
Console.WriteLine("Hello World!");
|
|
|
|
var provider = GetServiceProvider();
|
|
|
|
var service = provider.GetService<IPublicIPService>();
|
|
var result = await service.GetPublicIP();
|
|
|
|
Console.WriteLine(result.ip);
|
|
Console.ReadKey();
|
|
}
|
|
|
|
private static IServiceProvider GetServiceProvider()
|
|
{
|
|
var services = new ServiceCollection();
|
|
services.AddPublicIPService();
|
|
|
|
var provider = services.BuildServiceProvider();
|
|
return provider;
|
|
}
|
|
}
|
|
}
|