-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprogram.cs
42 lines (42 loc) · 1.9 KB
/
program.cs
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
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using DataOperations.Core;
using DataOperations.OData;
using DataOperations.OData.Client;
using GWSAMPLE_BASIC;
namespace GWSAMPLE_BASIC
{
public partial class Program
{
public static async Task Main(string[] args)
{
var host = Host.CreateDefaultBuilder()
.ConfigureServices((context,services) =>
{
// Register the SDK and dependencies for use in the SDK sample service
services
.RegisterBasicHttpAuthHandler(context.Configuration) // Register the BasicHttpAuthHandler for use in the SDK sample service, or whichever auth handler you need
.RegisterAPIKeyAuthHandler(context.Configuration) // Register the APIKeyAuthHandler for use in the SDK sample service, or whichever auth handler you need
.RegisterODataServices(context.Configuration) // Code is in Dependencies\DataOperations.OData\IServiceCollectionExtensions.cs, registers the OData Client Classes
.AddSingleton<DataOperations.IOperationsDispatcher, ODataOperationsDispatcher>()
.RegisterSetsAsSingletons() // Generated in the Data.GWSAMPLE_BASIC project, registers the poco classes as singletons
.AddHostedService<TestService>(); // Inject the test background service into the DI container
})
.ConfigureLogging(logging =>
{
logging.AddConsole()
.SetMinimumLevel(LogLevel.Warning);
})
.Build();
try
{
await host.RunAsync();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}