22 * Copyright (c) 2005-2020 The OPC Foundation, Inc. All rights reserved.
33 *
44 * OPC Foundation MIT License 1.00
5- *
5+ *
66 * Permission is hereby granted, free of charge, to any person
77 * obtaining a copy of this software and associated documentation
88 * files (the "Software"), to deal in the Software without
1111 * copies of the Software, and to permit persons to whom the
1212 * Software is furnished to do so, subject to the following
1313 * conditions:
14- *
14+ *
1515 * The above copyright notice and this permission notice shall be
1616 * included in all copies or substantial portions of the Software.
1717 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
@@ -87,7 +87,9 @@ public static async Task<int> Main(string[] args)
8787 IServiceCollection services = new ServiceCollection ( )
8888 . AddConfigurationServices ( )
8989 . AddServerServices ( )
90- . AddScoped < IReferenceServer , ReferenceServer > ( ) ;
90+ . AddScoped < IReferenceServer , ReferenceServer > ( )
91+ . AddScoped ( sp => new LogWriter ( ) )
92+ . AddScoped < IUAServer < IReferenceServer > , UAServer < IReferenceServer > > ( ) ;
9193
9294 IServiceProvider serviceProvider = services . BuildServiceProvider ( ) ;
9395
@@ -98,17 +100,13 @@ public static async Task<int> Main(string[] args)
98100
99101 if ( logConsole && appLog )
100102 {
101- output = new LogWriter ( ) ;
103+ output = serviceProvider . GetRequiredService < LogWriter > ( ) ;
102104 }
103105
104106 // create the UA server
105- var server = new UAServer < IReferenceServer > (
106- serviceProvider . GetRequiredService < IApplicationInstance > ( ) ,
107- serviceProvider . GetRequiredService < IReferenceServer > ( ) ,
108- output ) {
109- AutoAccept = autoAccept ,
110- Password = password
111- } ;
107+ IUAServer < IReferenceServer > server = serviceProvider . GetRequiredService < IUAServer < IReferenceServer > > ( ) ;
108+ server . AutoAccept = autoAccept ;
109+ server . Password = password ;
112110
113111 // load the server configuration, validate certificates
114112 output . WriteLine ( "Loading configuration from {0}." , configSectionName ) ;
0 commit comments