Exemple #1
0
        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();
        }
Exemple #2
0
        public EventCommandStatus Flush(string collection)
        {
            var cmd = new { _action = DensoBuiltinCommands.CollectionFlush, _collection = collection };

            return(EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(cmd)), this));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
 public EventCommandStatus Execute <T>(T command) where T : class
 {
     return(EventCommandStatus.Create(_command.Execute(DataBase, JsonConvert.SerializeObject(command)), this));
 }
Exemple #5
0
        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));
        }