Example #1
0
        public CommandResult Execute(DeletePostCommand command)
        {
            var comments = _db.Select <BlogComment>("from " + DBTableNames.BlogComments + " where PostId==?", command.PostId);

            if (comments.Count() > 0)
            {
                var commentKeys = comments.Select(s => s.Id).ToArray();
                _db.Delete(DBTableNames.BlogComments, commentKeys);
            }
            _db.Delete(DBTableNames.BlogPosts, command.PostId);
            return(CommandResult.SuccessResult);
        }
Example #2
0
        public CommandResult Execute(DeleteCommentCommand command)
        {
            _db.Delete(DBTableNames.BlogComments, command.CommentId);

            return(CommandResult.SuccessResult);
        }
Example #3
0
        /// <summary>
        /// 删除数据
        /// </summary>
        public void DeleteData <T>(object keyValue)
        {
            string tableName = typeof(T).Name;

            _autoBox.Delete(tableName, keyValue);
        }