public static GetConfigurationAsync ( |
||
rootUri | ||
username | string | |
password | string | |
Résultat | Task |
public virtual async Task ConnectAsync(NeoServerConfiguration configuration = null) { if (IsConnected) { return; } var stopwatch = Stopwatch.StartNew(); var operationCompletedArgs = new OperationCompletedEventArgs { QueryText = "Connect", ResourcesReturned = 0 }; Action stopTimerAndNotifyCompleted = () => { stopwatch.Stop(); operationCompletedArgs.TimeTaken = stopwatch.Elapsed; OnOperationCompleted(operationCompletedArgs); }; try { configuration = configuration ?? await NeoServerConfiguration.GetConfigurationAsync( RootUri, ExecutionConfiguration.Username, ExecutionConfiguration.Password, ExecutionConfiguration.Realm, ExecutionConfiguration).ConfigureAwait(false); RootApiResponse = configuration.ApiConfig; if (!string.IsNullOrWhiteSpace(RootApiResponse.Transaction)) { // transactionManager = new TransactionManager(this); } rootNode = string.IsNullOrEmpty(RootApiResponse.ReferenceNode) ? null : new RootNode(long.Parse(GetLastPathSegment(RootApiResponse.ReferenceNode)), this); // http://blog.neo4j.org/2012/04/streaming-rest-api-interview-with.html ExecutionConfiguration.UseJsonStreaming = ExecutionConfiguration.UseJsonStreaming && RootApiResponse.Version >= new Version(1, 8); if (RootApiResponse.Version < new Version(2, 0)) { cypherCapabilities = CypherCapabilities.Cypher19; } if (RootApiResponse.Version >= new Version(2, 2)) { cypherCapabilities = CypherCapabilities.Cypher22; } if (RootApiResponse.Version >= new Version(2, 2, 6)) { cypherCapabilities = CypherCapabilities.Cypher226; } if (RootApiResponse.Version >= new Version(2, 3)) { cypherCapabilities = CypherCapabilities.Cypher23; } if (RootApiResponse.Version >= new Version(3, 0)) { cypherCapabilities = CypherCapabilities.Cypher30; } } catch (AggregateException ex) { Exception unwrappedException; var wasUnwrapped = ex.TryUnwrap(out unwrappedException); operationCompletedArgs.Exception = wasUnwrapped ? unwrappedException : ex; stopTimerAndNotifyCompleted(); if (wasUnwrapped) { throw unwrappedException; } throw; } catch (Exception e) { operationCompletedArgs.Exception = e; stopTimerAndNotifyCompleted(); throw; } stopTimerAndNotifyCompleted(); }
public virtual async Task ConnectAsync(NeoServerConfiguration configuration = null) { if (IsConnected) { return; } var stopwatch = Stopwatch.StartNew(); var operationCompletedArgs = new OperationCompletedEventArgs { QueryText = "Connect", ResourcesReturned = 0 }; void StopTimerAndNotifyCompleted() { stopwatch.Stop(); operationCompletedArgs.TimeTaken = stopwatch.Elapsed; OnOperationCompleted(operationCompletedArgs); } try { configuration = configuration ?? await NeoServerConfiguration.GetConfigurationAsync( RootUri, ExecutionConfiguration.Username, ExecutionConfiguration.Password, ExecutionConfiguration.Realm, ExecutionConfiguration.EncryptionLevel, ExecutionConfiguration).ConfigureAwait(false); RootApiResponse = configuration.ApiConfig; if (!string.IsNullOrWhiteSpace(RootApiResponse.Transaction)) { transactionManager = new TransactionManager(this); } // http://blog.neo4j.org/2012/04/streaming-rest-api-interview-with.html ExecutionConfiguration.UseJsonStreaming = ExecutionConfiguration.UseJsonStreaming && RootApiResponse.Version >= new Version(1, 8); var version = RootApiResponse.Version; if (version < new Version(2, 0)) { CypherCapabilities = CypherCapabilities.Cypher19; } if (version >= new Version(2, 2)) { CypherCapabilities = CypherCapabilities.Cypher22; } if (version >= new Version(2, 2, 6)) { CypherCapabilities = CypherCapabilities.Cypher226; } if (version >= new Version(2, 3)) { CypherCapabilities = CypherCapabilities.Cypher23; } if (version >= new Version(3, 0)) { CypherCapabilities = CypherCapabilities.Cypher30; } if (version >= new Version(4, 0)) { CypherCapabilities = CypherCapabilities.Cypher40; } if (ServerVersion >= new Version(4, 4)) { CypherCapabilities = CypherCapabilities.Cypher44; } } catch (AggregateException ex) { var wasUnwrapped = ex.TryUnwrap(out var unwrappedException); operationCompletedArgs.Exception = wasUnwrapped ? unwrappedException : ex; StopTimerAndNotifyCompleted(); if (wasUnwrapped) { throw unwrappedException; } throw; } catch (Exception e) { operationCompletedArgs.Exception = e; StopTimerAndNotifyCompleted(); throw; } StopTimerAndNotifyCompleted(); }