/// <summary> /// prüft ob doc existiert /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <bool> ExistsDocument <T>(string id) where T : Entity { var source = CreateQuery <T>(new FeedOptions { MaxItemCount = 1, EnableCrossPartitionQuery = false }) .Where(x => x.EntityId == id && x.EntityType == KeyCache.GetEntityTypeKey <T>()); var query = source.AsDocumentQuery(); if (query.HasMoreResults) { var result = await query.ExecuteNextAsync().ConfigureAwait(false); _logger.LogTrace("ExistsDocument: {DocumentId} RequestUnits: {RequestCharge} ", id, result.RequestCharge); if (result.Any()) { return(true); } } return(false); }
public IMongoCollection <T> GetCol <T>() where T : Entity { return(Database.Value.GetCollection <T>(KeyCache.GetEntityTypeKey <T>())); }