From ca8ae0342dc22c9b5adedbd94b9c8a4770020e61 Mon Sep 17 00:00:00 2001 From: KirillKurdyukov Date: Wed, 11 Sep 2024 17:21:54 +0300 Subject: [PATCH] fix --- examples/src/DapperExample/Program.cs | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/examples/src/DapperExample/Program.cs b/examples/src/DapperExample/Program.cs index 66562eab..bcb1b051 100644 --- a/examples/src/DapperExample/Program.cs +++ b/examples/src/DapperExample/Program.cs @@ -4,25 +4,24 @@ using Ydb.Sdk.Ado; // Init Users table -await using var connection = await new YdbDataSource().OpenConnectionAsync(); -await connection.OpenAsync(); - -connection.ExecuteAsync(""" - CREATE TABLE Users( - Id Int32, - Name Text, - Email Text, - PRIMARY KEY (Id) - ); - """); - -connection.ExecuteAsync("INSERT INTO Users(Id, Name, Email) VALUES ($Id, $Name, $Email)", +using var connection = new YdbDataSource().OpenConnection(); + +connection.Execute(""" + CREATE TABLE Users( + Id Int32, + Name Text, + Email Text, + PRIMARY KEY (Id) + ); + """); + +connection.Execute("INSERT INTO Users(Id, Name, Email) VALUES ($Id, $Name, $Email)", new User { Id = 1, Name = "Name", Email = "Email" }); -Console.WriteLine(connection.QuerySingleAsync("SELECT * FROM Users WHERE Id = $Id", +Console.WriteLine(connection.QuerySingle("SELECT * FROM Users WHERE Id = $Id", new { Id = 1 })); -await connection.ExecuteAsync("DROP TABLE Users"); +connection.Execute("DROP TABLE Users"); internal class User {