Esempio n. 1
0
        protected virtual JsonSerializerSettings CreateSerializerSettings()
        {
            var settings = new JsonSerializerSettings();

            _ = settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            return(settings);
        }
 public TestActionstepService()
 {
     _mockResponses          = new List <MockResponseInfo>();
     _jsonSerializerSettings = new JsonSerializerSettings();
     _jsonSerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
     _jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
 }
Esempio n. 3
0
        private static JsonSerializerSettings ConfigureJson(JsonSerializerSettings settings, TypeNameHandling typeNameHandling)
        {
            settings.SerializationBinder = new TypeNameSerializationBinder(TypeNameRegistry);

            settings.ContractResolver = new ConverterContractResolver(
                new InstantConverter(),
                new LanguageConverter(),
                new NamedGuidIdConverter(),
                new NamedLongIdConverter(),
                new NamedStringIdConverter(),
                new PropertiesBagConverter(),
                new RefTokenConverter(),
                new StringEnumConverter());

            settings.NullValueHandling = NullValueHandling.Ignore;

            settings.DateFormatHandling = DateFormatHandling.IsoDateFormat;
            settings.DateParseHandling  = DateParseHandling.None;

            settings.TypeNameHandling = typeNameHandling;

            settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);

            return(settings);
        }
Esempio n. 4
0
        public static string ToJson(this LocalDate localDate)
        {
            var serializer = new JsonSerializerSettings();

            serializer.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            return(JsonConvert.SerializeObject(localDate, serializer));
        }
Esempio n. 5
0
        public Task PublishAsync(IDomainEvent domainEvent)
        {
            return(Task.Run(() =>
            {
                var settings = new JsonSerializerSettings();
                settings.ConfigureForNodaTime(DateTimeZoneProviders.Serialization);
                var @event = JsonConvert.SerializeObject(domainEvent, settings);
                var bytes = Encoding.UTF8.GetBytes(@event);

                var props = channel.CreateBasicProperties();
                props.Persistent = true;
                props.ContentType = "application/json";
                props.Headers = new Dictionary <string, object>
                {
                    { "eventId", domainEvent.EventId.ToString() },
                    { "parentEventId", domainEvent.ParentEventId.ToString() },
                    { "createdAt", domainEvent.CreatedAt.ToString() },
                    { "author", domainEvent.Author.ToString() },
                    { "name", domainEvent.Name },
                    { "id", domainEvent.Id.ToString() },
                    { "authorId", domainEvent.AuthorId.ToString() }
                };

                channel.BasicPublish(exchangeName, routingKey, props, bytes);
            }));
        }
        public static RefitSettings CreateRefitSettings()
        {
            var serializerSettings = new JsonSerializerSettings
            {
                NullValueHandling              = NullValueHandling.Ignore,
                ReferenceLoopHandling          = ReferenceLoopHandling.Serialize,
                PreserveReferencesHandling     = PreserveReferencesHandling.Objects,
                TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
                TypeNameHandling = TypeNameHandling.Auto,
                ContractResolver = new CamelCasePropertyNamesContractResolver
                {
                    NamingStrategy = new CamelCaseNamingStrategy
                    {
                        ProcessDictionaryKeys     = false,
                        ProcessExtensionDataNames = true,
                        OverrideSpecifiedNames    = false
                    }
                }
            };

            serializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            serializerSettings.Converters.Add(new FlagEnumConverter(new DefaultNamingStrategy()));
            serializerSettings.Converters.Add(new TypeConverter());
            serializerSettings.Converters.Add(new VersionOptionsConverter());

            return(new RefitSettings
            {
                ContentSerializer = new NewtonsoftJsonContentSerializer(serializerSettings)
            });
        }
Esempio n. 7
0
 public CaliperClient(CaliperEndpointOptions options, string sensorId)
 {
     _options            = options;
     _sensorId           = sensorId;
     _serializerSettings = new JsonSerializerSettings();
     _serializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
 }
        public async Task Start()
        {
            var busConfigurer = Configure.With(new SimpleInjectorContainerAdapter(_container))
                                .Logging(l => l.NLog())
                                .Transport(t => t.UseAzureServiceBus(_config.AsbConnectionString, "q_" + _name).AutomaticallyRenewPeekLock())
                                .Options(o =>
            {
                o.EnableCompression();
                o.SetMaxParallelism(1);
                o.SetNumberOfWorkers(1);
            })
                                .Serialization(s =>
            {
                var cfg = new JsonSerializerSettings();
                cfg.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
                cfg.TypeNameHandling       = TypeNameHandling.None;
                cfg.ObjectCreationHandling = ObjectCreationHandling.Replace;
                s.UseNewtonsoftJson(cfg);
            })
                                .Sagas(s => s.StoreInSqlServer(_config.SagaSqlConnectionString, "REBUS_Saga_" + _name, "REBUS_SagaIndex_" + _name))
            ;

            _container.Register <IHandleMessages <ResourceSliceReady>, SliceSplitter>();
            _container.Register <IHandleMessages <Ark.Tasks.Messages.ResourceSliceReady>, SliceSplitter>();
            _container.Register <IHandleMessages <SliceReady>, SliceActivitySaga>();
            _container.Register <IHandleMessages <Ark.Tasks.Messages.SliceReady>, SliceActivitySaga>();
            _container.Register <ISliceActivity>(_activityFactory);

            var bus = busConfigurer.Start();

            foreach (var d in _dependencies)
            {
                await bus.Advanced.Topics.Subscribe(d.ToString()).ConfigureAwait(false);
            }
        }
 public RebusResourceNotifier(IRebusResourceNotifier_Config config)
 {
     _providerName = config.ProviderName;
     _configurer   = Configure.With(new SimpleInjectorContainerAdapter(_container))
                     .Logging(l => l.NLog())
                     .Transport(t => t.UseAzureServiceBusAsOneWayClient(config.AsbConnectionString))
                     .Options(o =>
     {
         o.EnableCompression();
         o.SetMaxParallelism(1);
         o.SetNumberOfWorkers(1);
     })
                     .Serialization(s =>
     {
         var cfg = new JsonSerializerSettings();
         cfg     = cfg.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
         cfg.TypeNameHandling       = TypeNameHandling.None;
         cfg.ObjectCreationHandling = ObjectCreationHandling.Replace;
         s.UseNewtonsoftJson(cfg);
     })
     ;
     if (config.StartAtCreation)
     {
         Start();
     }
 }
Esempio n. 10
0
        private static JsonSerializerSettings CreateSerializerSettings()
        {
            var settings = new JsonSerializerSettings
            {
                TypeNameHandling               = TypeNameHandling.Auto,
                NullValueHandling              = NullValueHandling.Ignore,
                ReferenceLoopHandling          = ReferenceLoopHandling.Serialize,
                PreserveReferencesHandling     = PreserveReferencesHandling.Objects,
                TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
            };

            settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            settings.Converters.Add(new VersionOptionsJsonConverter());
            settings.Converters.Add(new TypeJsonConverter());
            settings.Converters.Add(new StringEnumConverter(new DefaultNamingStrategy()));
            settings.NullValueHandling = NullValueHandling.Ignore;

            settings.ContractResolver = new DefaultContractResolver
            {
                NamingStrategy = new DefaultNamingStrategy
                {
                    ProcessDictionaryKeys     = false,
                    ProcessExtensionDataNames = true,
                    OverrideSpecifiedNames    = false
                }
            };

            settings.Converters.Add(new FlagEnumConverter(new DefaultNamingStrategy()));
            settings.Converters.Add(new TypeJsonConverter());
            settings.Converters.Add(new VersionOptionsJsonConverter());
            settings.Converters.Add(new InlineFunctionJsonConverter());

            return(settings);
        }
Esempio n. 11
0
 public RebusResourceNotifier(IRebusResourceNotifier_Config config)
 {
     _providerName = config.ProviderName;
     _container.ConfigureRebus(c => c
                               .Logging(l => l.NLog())
                               .Transport(t => t.UseAzureServiceBusAsOneWayClient(config.AsbConnectionString).UseLegacyNaming())
                               .Options(o =>
     {
         o.EnableCompression();
         o.SetMaxParallelism(1);
         o.SetNumberOfWorkers(1);
         o.SimpleRetryStrategy(maxDeliveryAttempts: ResourceConstants.MaxRetryCount);
     })
                               .Serialization(s =>
     {
         var cfg = new JsonSerializerSettings();
         cfg     = cfg.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
         cfg.TypeNameHandling       = TypeNameHandling.None;
         cfg.ObjectCreationHandling = ObjectCreationHandling.Replace;
         s.UseNewtonsoftJson(cfg);
     })
                               );
     if (config.StartAtCreation)
     {
         Start();
     }
 }
        /// <summary>
        /// Configures swagger to use NodaTime types.
        /// </summary>
        /// <param name="config">Options to configure swagger.</param>
        /// <param name="serializerSettings">Settings to configure serialization.</param>
        public static void ConfigureForNodaTime(this SwaggerGenOptions config, JsonSerializerSettings serializerSettings)
        {
            bool isNodaConvertersRegistered = serializerSettings.Converters.Any(converter => converter is NodaConverterBase <Instant>);

            if (!isNodaConvertersRegistered)
            {
                serializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            }

            Schemas schemas = new SchemasFactory(serializerSettings).CreateSchemas();

            config.MapType <Instant>        (schemas.Instant);
            config.MapType <LocalDate>      (schemas.LocalDate);
            config.MapType <LocalTime>      (schemas.LocalTime);
            config.MapType <LocalDateTime>  (schemas.LocalDateTime);
            config.MapType <OffsetDateTime> (schemas.OffsetDateTime);
            config.MapType <ZonedDateTime>  (schemas.ZonedDateTime);
            config.MapType <Interval>       (schemas.Interval);
            config.MapType <DateInterval>   (schemas.DateInterval);
            config.MapType <Offset>         (schemas.Offset);
            config.MapType <Period>         (schemas.Period);
            config.MapType <Duration>       (schemas.Duration);
            config.MapType <DateTimeZone>   (schemas.DateTimeZone);

            config.MapType <Instant?>       (schemas.Instant);
            config.MapType <LocalDate?>     (schemas.LocalDate);
            config.MapType <LocalTime?>     (schemas.LocalTime);
            config.MapType <LocalDateTime?> (schemas.LocalDateTime);
            config.MapType <OffsetDateTime?>(schemas.OffsetDateTime);
            config.MapType <ZonedDateTime?> (schemas.ZonedDateTime);
            config.MapType <Interval?>      (schemas.Interval);
            config.MapType <Offset?>        (schemas.Offset);
            config.MapType <Duration?>      (schemas.Duration);
        }
Esempio n. 13
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddTransient <LoginService>();
            services.AddTransient <IAuthDispatcher, MailgunApiClient>();
            services.AddTransient <IPinRepository, PinManager>();
            services.AddTransient <IUserRepository, UserManager>();
            services.AddSingleton <IClock>(x => SystemClock.Instance);

            services.Configure <SecurityConfig>(Configuration.GetSection("PasswordSecurity"));
            services.Configure <MailGunConfig>(Configuration.GetSection("MailGunConfig"));

            services.AddDbContext <DdNetDbContext>(options => options.UseMySql(Configuration.GetConnectionString("DdNetDb"),
                                                                               new MySqlServerVersion(new Version(8, 0, 23)), mySqlOptions => mySqlOptions.CharSetBehavior(CharSetBehavior.NeverAppend)));

            services.AddControllers();

            var basicSettings = new JsonSerializerSettings()
            {
                DateParseHandling = DateParseHandling.None,
                NullValueHandling = NullValueHandling.Ignore
            };

            basicSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);

            JsonConvert.DefaultSettings = () => basicSettings;

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "DDNet", Version = "v1"
                });
            });

            services.AddMvc();
        }
Esempio n. 14
0
        private static JsonSerializerSettings ConfigureJson(JsonSerializerSettings settings, TypeNameHandling typeNameHandling)
        {
            settings.SerializationBinder = new TypeNameSerializationBinder(TypeNameRegistry);

            settings.ContractResolver = new ConverterContractResolver(
                new AppClientsConverter(),
                new AppContributorsConverter(),
                new AppPatternsConverter(),
                new ClaimsPrincipalConverter(),
                new InstantConverter(),
                new LanguageConverter(),
                new LanguagesConfigConverter(),
                new NamedGuidIdConverter(),
                new NamedLongIdConverter(),
                new NamedStringIdConverter(),
                new PropertiesBagConverter <EnvelopeHeaders>(),
                new PropertiesBagConverter <PropertiesBag>(),
                new RefTokenConverter(),
                new RuleConverter(),
                new SchemaConverter(FieldRegistry),
                new StringEnumConverter());

            settings.NullValueHandling = NullValueHandling.Ignore;

            settings.DateFormatHandling = DateFormatHandling.IsoDateFormat;
            settings.DateParseHandling  = DateParseHandling.None;

            settings.TypeNameHandling = typeNameHandling;

            settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);

            return(settings);
        }
Esempio n. 15
0
        public static JsonSerializerSettings GetNodaTimeSerializerSettings()
        {
            var jsonSerializerSettings = new JsonSerializerSettings();

            jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            return(jsonSerializerSettings);
        }
        static CustomJsonContentSerializer()
        {
            JsonSettings = new JsonSerializerSettings
            {
                TypeNameHandling               = TypeNameHandling.Auto,
                NullValueHandling              = NullValueHandling.Ignore,
                ReferenceLoopHandling          = ReferenceLoopHandling.Serialize,
                PreserveReferencesHandling     = PreserveReferencesHandling.Objects,
                TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
            };

            JsonSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            JsonSettings.Converters.Add(new VersionOptionsJsonConverter());
            JsonSettings.Converters.Add(new TypeJsonConverter());
            JsonSettings.Converters.Add(new StringEnumConverter(new DefaultNamingStrategy()));
            JsonSettings.NullValueHandling = NullValueHandling.Ignore;

            JsonSettings.ContractResolver = new DefaultContractResolver
            {
                NamingStrategy = new DefaultNamingStrategy
                {
                    ProcessDictionaryKeys     = true,
                    ProcessExtensionDataNames = true
                }
            };
        }
Esempio n. 17
0
 static JsonSerializeUtils()
 {
     serializerSettings = new JsonSerializerSettings();
     serializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
     serializerSettings.NullValueHandling    = NullValueHandling.Ignore;
     serializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore;
 }
Esempio n. 18
0
    /// <summary>
    ///     Configure System.Text.Json with defaults for launchpad
    /// </summary>
    /// <param name="options"></param>
    /// <param name="dateTimeZoneProvider"></param>
    /// <returns></returns>
    public static JsonSerializerSettings ConfigureNodaTimeForLaunchPad(this JsonSerializerSettings options, IDateTimeZoneProvider dateTimeZoneProvider)
    {
        options.Converters.Add(new StringEnumConverter(new CamelCaseNamingStrategy()));
        options.ConfigureForNodaTime(dateTimeZoneProvider);
        ReplaceConverters(options.Converters, dateTimeZoneProvider);

        return(options);
    }
Esempio n. 19
0
        /// <summary>
        /// Client constructor Auth credentials / ApiKey can be passed through config
        /// </summary>
        /// <param name="config">Config</param>
        /// <param name="Url">String</param>
        /// /// <param name="policy">String</param>
        public Client(IArtesianServiceConfig config, string Url, ArtesianPolicyConfig policy)
        {
            _url    = config.BaseAddress.ToString().AppendPathSegment(Url);
            _apiKey = config.ApiKey;
            _config = config;

            var cfg = new JsonSerializerSettings();

            cfg                  = cfg.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            cfg                  = cfg.ConfigureForDictionary();
            cfg                  = cfg.ConfigureForNodaTimeRanges();
            cfg.Formatting       = Formatting.Indented;
            cfg.ContractResolver = new DefaultContractResolver();
            cfg.Converters.Add(new StringEnumConverter());
            cfg.TypeNameHandling       = TypeNameHandling.None;
            cfg.ObjectCreationHandling = ObjectCreationHandling.Replace;

            var jsonFormatter = new JsonMediaTypeFormatter
            {
                SerializerSettings = cfg
            };

            _jsonFormatter = jsonFormatter;
            _jsonFormatter.SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/problem+json"));

            _msgPackFormatter    = new MessagePackMediaTypeFormatter(CustomCompositeResolver.Instance);
            _lz4msgPackFormatter = new LZ4MessagePackMediaTypeFormatter(CustomCompositeResolver.Instance);
            //Order of formatters important for correct weight in accept header
            var formatters = new MediaTypeFormatterCollection();

            formatters.Clear();
            formatters.Add(_lz4msgPackFormatter);
            formatters.Add(_msgPackFormatter);
            formatters.Add(_jsonFormatter);
            _formatters = formatters;

            _resilienceStrategy = policy.GetResillianceStrategy();

            if (config.ApiKey == null)
            {
                var domain = new Uri(config.Domain);

                var tenantId = domain.Segments
                               .Select(s => s.Trim('/'))
                               .Where(w => !string.IsNullOrWhiteSpace(w))
                               .FirstOrDefault();

                _confidentialClientApplication = ConfidentialClientApplicationBuilder
                                                 .Create(config.ClientId)
                                                 .WithTenantId(tenantId)
                                                 .WithClientSecret(config.ClientSecret)
                                                 .Build();
            }

            _client = new FlurlClient(_url);
            _client.WithTimeout(TimeSpan.FromMinutes(ArtesianConstants.ServiceRequestTimeOutMinutes));
        }
 public PexaApiTokenQueryTests()
 {
     JsonConvert.DefaultSettings = () =>
     {
         var jsonSerializerSettings = new JsonSerializerSettings();
         jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
         return(jsonSerializerSettings);
     };
 }
Esempio n. 21
0
 public static JsonSerializerSettings ConfigureForArkDefault(this JsonSerializerSettings settings)
 {
     settings.NullValueHandling      = NullValueHandling.Include;
     settings.TypeNameHandling       = TypeNameHandling.None;
     settings.ObjectCreationHandling = ObjectCreationHandling.Replace;
     settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
     settings.ConfigureForNodaTimeRanges();
     settings.Converters.Add(new StringEnumConverter());
     return(settings);
 }
Esempio n. 22
0
        public static byte[] Serialized <T>(this T message)
        {
            var settings = new JsonSerializerSettings();

            settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);

            var json = JsonConvert.SerializeObject(message, settings);

            return(Encoding.UTF8.GetBytes(json));
        }
Esempio n. 23
0
        public static T DeepClone <T>(this T obj)
        {
            if (ReferenceEquals(obj, null))
            {
                return(default(T));
            }

            var settings = new JsonSerializerSettings();

            settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            return(JsonConvert.DeserializeObject <T>(JsonConvert.SerializeObject(obj, settings), settings));
        }
Esempio n. 24
0
 static JsonBackedServiceBase()
 {
     JsonSerializerSettings = new JsonSerializerSettings
     {
         Formatting       = Formatting.Indented,
         ContractResolver = new CamelCasePropertyNamesContractResolver()
     };
     JsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
     JsonSerializerSettings.Converters.Add(new StringEnumConverter {
         CamelCaseText = true
     });
 }
Esempio n. 25
0
        public SqlStateProvider(ISqlStateProviderConfig config, IDbConnectionManager connManager)
        {
            EnsureArg.IsNotNull(config);
            EnsureArg.IsNotNull(connManager);

            _connManager            = connManager;
            _config                 = config;
            _jsonSerializerSettings = new JsonSerializerSettings();
            _jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            _jsonSerializerSettings.NullValueHandling = NullValueHandling.Include;
            _jsonSerializerSettings.TypeNameHandling  = TypeNameHandling.None;
            _jsonSerializerSettings.Converters.Add(new StringEnumConverter());
        }
Esempio n. 26
0
        private static JsonSerializerSettings CreateJsonSerializerSettings()
        {
            var jsonSerializerSettings = new JsonSerializerSettings
            {
                DateParseHandling = DateParseHandling.None
            };

            jsonSerializerSettings.Converters.Add(new BaseNotificationProtocolConfigurationConverter());
            jsonSerializerSettings.Converters.Add(new BaseTelemetryProtocolConfigurationConverter());
            jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            jsonSerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            return(jsonSerializerSettings);
        }
Esempio n. 27
0
        /// <summary>
        /// Add common converters to the settings
        /// </summary>
        /// <param name="settings">settings to update</param>
        public static void AddCommonConverters(JsonSerializerSettings settings)
        {
            settings = Arguments.EnsureNotNull(settings, nameof(settings));

            settings.Converters.Add(new IpAddressConverter());
            settings.Converters.Add(new IPEndPointConverter());
            settings.Converters.Add(new StringEnumConverter());
            settings.Converters.Add(new TimeSpanConverter());
            settings.Converters.Add(new NullableConverter());
            settings.Converters.Add(new DecimalFloatReader());

            settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
        }
Esempio n. 28
0
        private static JsonSerializerSettings CreateSerializerSettings()
        {
            var settings = new JsonSerializerSettings
            {
                ContractResolver = new DefaultContractResolver
                {
                    NamingStrategy = new SnakeCaseNamingStrategy()
                }
            };

            settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            return(settings);
        }
        public YamlTokenFormatter()
        {
            serializer   = new SerializerBuilder().Build();
            deserializer = new DeserializerBuilder().Build();

            jsonSerializerSettings = new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore,
            };

            jsonSerializerSettings
            .ConfigureForNodaTime(DateTimeZoneProviders.Tzdb)
            .Converters.Add(new ExpandoObjectConverter());
        }
Esempio n. 30
0
        /// <summary>
        /// Create an implementation of <see cref="IBankMasterClient"/> wit Refit configured to use Newtonsoft.Json for JSON deserialization.
        /// </summary>
        /// <param name="httpMessageHandlerFactory">Optionally supply a custom inner <see cref="HttpMessageHandler"/>.</param>
        /// <returns>An implementation of <see cref="IBankMasterClient"/> using Newtonsoft.Json.</returns>
        public static IBankMasterClient CreateNewtonsoftJsonClient(Func <HttpMessageHandler>?httpMessageHandlerFactory = null)
        {
            var jsonSerializerSettings = new JsonSerializerSettings();

            jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            var contentSerializer = new NewtonsoftJsonContentSerializer(jsonSerializerSettings);
            var settings          = new RefitSettings(contentSerializer)
            {
                HttpMessageHandlerFactory = httpMessageHandlerFactory
            };

            return(RestService.For <IBankMasterClient>(BaseUri.ToString(), settings));
        }