public EventCommandStatus DeleteAll <T>(string collection, IEnumerable <T> entities) where T : class { EventCommandStatus cs = new EventCommandStatus(); foreach (var item in entities) { cs = Delete(collection, item); } return(cs); }
public EventCommandStatus Delete <T>(string collection, T entity) { var enttype = typeof(T); var pi = enttype.GetProperty(DocumentMetadata.IdPropertyName); if (pi != null) { var cmd = new { _action = DensoBuiltinCommands.Delete, _id = pi.GetValue(entity, null), _collection = collection }; return(EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(cmd)), this)); } throw new DocumentWithoutIdException(); }
public EventCommandStatus SetAll <T>(string collection, IEnumerable <T> entity) where T : class { EventCommandStatus result = new EventCommandStatus(); foreach (var item in entity) { result = Set <T>(collection, item); } return(result); //var cmd = new { _action = DensoBuiltinCommands.SetMany, _collection = collection, _value = entity }; //return EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(cmd)), this); }
public EventCommandStatus Flush(string collection) { var cmd = new { _action = DensoBuiltinCommands.CollectionFlush, _collection = collection }; return(EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(cmd)), this)); }
public EventCommandStatus Flush <T>() where T : class { var cmd = new { _action = DensoBuiltinCommands.CollectionFlush, _collection = typeof(T).Name }; return(EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(cmd)), this)); }
public EventCommandStatus Execute <T>(T command) where T : class { return(EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(command)), this)); }
public EventCommandStatus Set <T>(string collection, T entity) where T : class { var cmd = new { _action = DensoBuiltinCommands.Set, _collection = collection, _value = entity }; return(EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(cmd)), this)); }