public void Delete <T>(T item) where T : class, new() { //WorkAround for DeleteOne parameter ObjectFilterDefinition <T> filter = new ObjectFilterDefinition <T>(item); // Remove the object. _db.GetCollection <T>(typeof(T).Name).FindOneAndDelete(filter); }
public async Task RevokeAsync(string subject, string client) { var filter = new ObjectFilterDefinition<BsonDocument>( new { _subjectId = subject, _clientId = client }); var result = await Collection.DeleteManyAsync(filter).ConfigureAwait(false); Log.Debug(result.ToString); }
public async Task RevokeAsync(string subject, string client) { var filter = new ObjectFilterDefinition <BsonDocument>( new { _subjectId = subject, _clientId = client }); var result = await Collection.DeleteManyAsync(filter).ConfigureAwait(false); Log.Debug(result.ToString); }
public virtual void Delete(TEntity entity) { //VALIDAZIONE ARGOMENTI if (entity == null) { throw new ArgumentNullException(nameof(entity)); } ObjectFilterDefinition <TEntity> filter = new ObjectFilterDefinition <TEntity>(entity); DataSession.MongoDatabase.GetCollection <TEntity>(_CollectionName).DeleteOne(filter); }
public async Task<IEnumerable<ITokenMetadata>> GetAllAsync(string subject) { var filter = new ObjectFilterDefinition<BsonDocument>( new { _subjectId = subject }); var results = await Collection.Find(filter).ToListAsync().ConfigureAwait(false); var deserializers = results.Select(_serializer.Deserialize); return await Task.WhenAll(deserializers).ConfigureAwait(false); }
public async Task <IEnumerable <ITokenMetadata> > GetAllAsync(string subject) { var filter = new ObjectFilterDefinition <BsonDocument>( new { _subjectId = subject }); var results = await Collection.Find(filter).ToListAsync().ConfigureAwait(false); var deserializers = results.Select(_serializer.Deserialize); return(await Task.WhenAll(deserializers).ConfigureAwait(false)); }