예제 #1
0
 public static IEnumerable<Message> GetMessages(Room room)
 {
     var messages = DapperUtil.Query<Message>(@"
         SELECT
             RoomId
             ,PostTime
             ,Number
             ,Name
             ,Comment
             ,IsAuth
             ,IsBan
             ,ListenerId
         FROM
             Message
         WHERE
             RoomId = @RoomId
         ORDER BY
             Order
         ;
     ", room);
     return messages;
 }
예제 #2
0
파일: Room.cs 프로젝트: madguy/CaveTalk
        public static void UpdateRoom(Room room)
        {
            DapperUtil.Execute(executor => {
                var transaction = executor.BeginTransaction();

                executor.Execute(@"
                    INSERT OR REPLACE INTO Room (
                        RoomId
                        ,Author
                        ,Title
                        ,Description
                        ,Tags
                        ,IdVisible
                        ,AnonymousOnly
                        ,StartTime
                        ,ListenerCount
                    ) VALUES (
                        @RoomId, @Author, @Title, @Description, @Tags, @IdVisible, @AnonymousOnly, @StartTime, @ListenerCount
                    );
                ", room, transaction);

                transaction.Commit();
            });
        }