예제 #1
0
        public void UpdateTest2()
        {
            var data = new UpdateDemo2 {
                Name = "cat", Ext1 = "ext1"
            };
            var con = new { id = 1 };
            var sql = DapperExt.Update(data, con, "myt");

            var exp = "UPDATE myt SET myName = @Name, Ext1 = @Ext1, Ext2 = @Ext2 WHERE id = @w_id";

            Assert.Equal(exp, sql);
        }
예제 #2
0
        public void UpdateModelWithIdTest2()
        {
            var data = new UpdateDemo4 {
                Id = 1, Name = "cat"
            };
            var con = new { id = 1 };
            var sql = DapperExt.Update(data, con, "myt");

            var exp = "UPDATE myt SET a_id = @Id, last_name = @Name WHERE id = @w_id";

            Assert.Equal(exp, sql);
        }