コード例 #1
0
        public static IWebSocketGremlinQueryExecutorBuilder Transform(
            this IWebSocketGremlinQueryExecutorBuilder builder,
            IEnumerable <IWebSocketGremlinQueryExecutorBuilderTransformation> webSocketTransformations)
        {
            foreach (var webSocketTransformation in webSocketTransformations)
            {
                builder = webSocketTransformation.Transform(builder);
            }

            return(builder);
        }
コード例 #2
0
        public static IWebSocketGremlinQueryExecutorBuilder Configure(
            this IWebSocketGremlinQueryExecutorBuilder builder,
            IConfiguration configuration)
        {
            var authenticationSection = configuration.GetSection("Authentication");
            var connectionPoolSection = configuration.GetSection("ConnectionPool");

            builder = builder
                      .At(configuration.GetRequiredConfiguration("Uri"))
                      .ConfigureConnectionPool(connectionPoolSettings =>
            {
                if (int.TryParse(connectionPoolSection[$"{nameof(ConnectionPoolSettings.MaxInProcessPerConnection)}"], out var maxInProcessPerConnection))
                {
                    connectionPoolSettings.MaxInProcessPerConnection = maxInProcessPerConnection;
                }

                if (int.TryParse(connectionPoolSection[$"{nameof(ConnectionPoolSettings.PoolSize)}"], out var poolSize))
                {
                    connectionPoolSettings.PoolSize = poolSize;
                }
            });

            if (configuration["Alias"] is { } alias)
            {
                builder = builder.SetAlias(alias);
            }

            if (authenticationSection["Username"] is { } username&& authenticationSection["Password"] is { } password)
            {
                builder = builder.AuthenticateBy(username, password);
            }

            if (Enum.TryParse <SerializationFormat>(configuration[$"{nameof(SerializationFormat)}"], out var graphsonVersion))
            {
                builder = builder.SetSerializationFormat(graphsonVersion);
            }

            return(builder);
        }
コード例 #3
0
 public IWebSocketGremlinQueryExecutorBuilder Transform(IWebSocketGremlinQueryExecutorBuilder builder)
 {
     return(_transformation(builder));
 }
コード例 #4
0
 public CosmosDbConfigurationBuilder(IWebSocketGremlinQueryExecutorBuilder webSocketBuilder, string?collectionName = default)
 {
     _collectionName   = collectionName;
     _webSocketBuilder = webSocketBuilder;
 }
コード例 #5
0
 public static IWebSocketGremlinQueryExecutorBuilder At(this IWebSocketGremlinQueryExecutorBuilder builder, string uri)
 {
     return(builder.At(new Uri(uri)));
 }
コード例 #6
0
 public static IWebSocketGremlinQueryExecutorBuilder AtLocalhost(this IWebSocketGremlinQueryExecutorBuilder builder)
 {
     return(builder.At(new Uri("ws://localhost:8182")));
 }