public T Get <T>(Guid id) where T : View { var doctype = typeof(T).Name; var viewId = $"{id}-{doctype}"; ViewDocument <T> view = _client.CreateDocumentQuery <ViewDocument <T> >(_collectionUri) .Where(db => db.Id == viewId && db.Type == doctype) .ToArray() .FirstOrDefault(); return(view?.Data); }
public async Task Update <T>(T view) where T : View { var viewDoc = new ViewDocument <T>(view); await _client.UpsertDocumentAsync(_collectionUri, viewDoc); }
public async Task Add <T>(T view) where T : View { var viewDoc = new ViewDocument <T>(view); await _client.CreateDocumentAsync(_collectionUri, viewDoc); }