Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SwiftCredentialsClient"/> class.
 /// </summary>
 /// <param name="settings">The service settings.</param>
 public SwiftCredentialsClient(SwiftCredentialsServiceClientSettings settings)
 {
     _service = new SwiftCredentialsAPI(new Uri(settings.ServiceUrl));
 }
Пример #2
0
        public static void RegisterSwiftCredentialsClient(this ContainerBuilder builder, SwiftCredentialsServiceClientSettings settings)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrWhiteSpace(settings.ServiceUrl))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(settings.ServiceUrl));
            }

            builder.RegisterType <SwiftCredentialsClient>()
            .WithParameter(TypedParameter.From(settings))
            .As <ISwiftCredentialsClient>()
            .SingleInstance();
        }