-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenWeatherMapClient.linq
52 lines (45 loc) · 1.37 KB
/
OpenWeatherMapClient.linq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<Query Kind="Program">
<Reference Relative="Arex388.OpenWeatherMap\bin\Debug\netstandard2.0\Arex388.OpenWeatherMap.dll">E:\Software Development\Arex388.OpenWeatherMap\Arex388.OpenWeatherMap\bin\Debug\netstandard2.0\Arex388.OpenWeatherMap.dll</Reference>
<NuGetReference>Microsoft.Extensions.Http</NuGetReference>
<Namespace>Arex388.OpenWeatherMap</Namespace>
<Namespace>Microsoft.Extensions.DependencyInjection</Namespace>
<Namespace>System.Threading.Tasks</Namespace>
</Query>
private static readonly OpenWeatherMapClientOptions _options = new OpenWeatherMapClientOptions {
Key = Util.GetPassword("openweathermap.key"),
Units = Units.Fahrenheit
};
async Task Main() {
//var openWeatherMap = GetClientMultiple();
//var openWeatherMap = GetClientSingle();
}
public IOpenWeatherMapClient GetClientMultiple() {
var services = new ServiceCollection().AddOpenWeatherMap().BuildServiceProvider();
var openWeatherMapFactory = services.GetRequiredService<IOpenWeatherMapClientFactory>();
return openWeatherMapFactory.CreateClient(_options);
}
public IOpenWeatherMapClient GetClientSingle() {
var services = new ServiceCollection().AddOpenWeatherMap(_options).BuildServiceProvider();
return services.GetRequiredService<IOpenWeatherMapClient>();
}
// ============================================================================
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// EoF