Using Azure DocumentDB and ASP.NET Core for extreme NoSQL performance

added by DotNetKicks
11/10/2016 2:43:12 PM

2 Kicks, 357 Views

private Uri GetCollectionLink() { return UriFactory.CreateDocumentCollectionUri(_settings.DatabaseName, _settings.CollectionName); } public DocumentDbProvider(DocumentDbSettings settings) { _settings = settings; _collectionUri = GetCollectionLink(); _dbClient = new DocumentClient(_settings.DatabaseUri, _settings.DatabaseKey, new ConnectionPolicy(){ MaxConnectionLimit = 100 }); _dbClient.OpenAsync().Wait(); } Inserting documents public async Task AddItem (T document) { var result = await _dbClient.CreateDocumentAsync(_collectionUri, document); return result.Resource.Id; } Updating


0 comments