Skip to content

Commit

Permalink
chore: fix dapper example (#186)
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

Co-authored-by: Victor Molostov <[email protected]>
  • Loading branch information
molostovvs and molostovvs authored Sep 16, 2024
1 parent af07da4 commit 6a4d4d2
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 6a4d4d2

Please sign in to comment.