Skip to content

Commit

Permalink
chore: fix dapper example
Browse files Browse the repository at this point in the history
parameters with the $ prefix are currently not supported, so we need to fix the example
  • Loading branch information
molostovvs committed Sep 13, 2024
1 parent af07da4 commit 248e67c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/src/DapperExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ PRIMARY KEY (Id)
);
""");

await connection.ExecuteAsync("INSERT INTO Users(Id, Name, Email) VALUES ($Id, $Name, $Email)",
await connection.ExecuteAsync("INSERT INTO Users(Id, Name, Email) VALUES (@Id, @Name, @Email)",
new User { Id = 1, Name = "Name", Email = "Email" });

Console.WriteLine(await connection.QuerySingleAsync<User>("SELECT * FROM Users WHERE Id = $Id",
Console.WriteLine(await connection.QuerySingleAsync<User>("SELECT * FROM Users WHERE Id = @Id",
new { Id = 1 }));

await connection.ExecuteAsync("DROP TABLE Users");
Expand Down

0 comments on commit 248e67c

Please sign in to comment.