public void Select_By_Sql() { var sql = "select * from SysUser where id=@Id"; var param = new { Id = 1 }; using (var conn = _Repository.GetDbConnection()) { var user = conn.QueryFirstOrDefault <SysUser>(sql, param); Assert.NotNull(user); Assert.Equal(user.Id, 1); Assert.Equal(user.UserName, "张三"); } }