public async Task Connect() { var connectionSettings = new OrientApiConnectionSettings(_settings); var connectCommand = new Connect(connectionSettings, _restClient); var batchResult = await connectCommand.Execute(); _orientConnection = batchResult switch { Result <OrientConnection, Exception> .OkCase ok => ok.Payload, Result <OrientConnection, Exception> .ErrCase err => throw err.Payload, _ => throw new InvalidOperationException() }; }
public async Task RefreshItem(Dictionary <string, string> result, OrientConnection setupConnection, IRestClient setupClient) { var rid = new Rid(Item.IsNew() ? result[Identifier.Sql] : Item.Rid); var select = new Select(new From(rid)); var batch = new OrientQueryBatch(setupConnection, select); var command = new Batch <List <T> >(batch, setupClient); var res = await command.Execute() switch { Result <List <T>, Exception> .OkCase o => o.Payload, Result <List <T>, Exception> .ErrCase e => throw e.Payload, _ => throw new InvalidCastException() }; DbItem = res.FirstOrDefault(); } }
public GraphSetup(OrientConnection connection, IRestClient restClient) { Connection = connection; Client = restClient; }