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