public static ClusterOptions GetClusterOptions()
        {
            var settings = GetSettings();
            var options  = new ConfigurationBuilder()
                           .AddJsonFile("config.json")
                           .Build()
                           .GetSection("couchbase")
                           .Get <ClusterOptions>();

            if (settings.EnableLogging)
            {
                IServiceCollection serviceCollection = new ServiceCollection();
                serviceCollection.AddLogging(builder => builder
                                             .AddFilter(level => level >= LogLevel.Debug)
                                             );

                var loggerFactory = serviceCollection.BuildServiceProvider().GetService <ILoggerFactory>();
                loggerFactory.AddFile("Logs/myapp-{Date}.txt", LogLevel.Debug);
                options.WithLogging(loggerFactory);
            }

            if (settings.SystemTextJson)
            {
                options.WithSerializer(SystemTextJsonSerializer.Create());
            }

            return(options);
        }
        internal static ClusterOptions GetClusterOptions()
        {
            var settings = GetSettings();
            var options  = new ConfigurationBuilder()
                           .AddJsonFile("config.json")
                           .Build()
                           .GetSection("couchbase")
                           .Get <ClusterOptions>();

            if (settings.SystemTextJson)
            {
                options.WithSerializer(SystemTextJsonSerializer.Create());
            }

            return(options);
        }
 private static ITypeSerializer GetSerializer(bool systemTextJson = false) =>
 systemTextJson
         ? SystemTextJsonSerializer.Create()
         : DefaultSerializer.Instance;
 private static SystemTextJsonSerializer CreateSerializer(bool withContext) =>
 withContext
         ? SystemTextJsonSerializer.Create(PersonContext.Default)
         : SystemTextJsonSerializer.Create();