예제 #1
0
 protected async Task <T> QueryFirstOrDefaultAsync <T>(string sql, object parameters = null)
 {
     using (IDbConnection connection = new Npgsql.NpgsqlConnection(this.connectionString))
     {
         try
         {
             connection.Open();
             return(await connection.QueryFirstOrDefaultAsync <T>(sql, parameters));
         }
         catch (Exception exc)
         {
             Console.WriteLine(exc);
             throw exc;
         }
     }
 }