title: cannot convert from 'System.Data.SqlClient.SqlConnection' to 'Microsoft.SqlServer.Management.Common.IRenewableToken'
body: <p>I am currenty creating SQLWorker class with various methods which excutes various sql commands as part of a wider framework. I have a method which is used to execute a sql scripts. as whon below:</p>
  <pre><code>public object ExecuteScript(string sql, ExecutionType executionType = ExecutionType.NonQuery,
          int statementTimeout = 1800)
      {
  
          using (var connection = new SqlConnection(ConnectionString))
          {
              connection.InfoMessage += (sender, args) =&gt;
                  _infoMessageText.AppendLine(args.Message);
  
              var server = new Server(new ServerConnection(connection));
              server.ConnectionContext.StatementTimeout = statementTimeout;
              switch (executionType)
              {
                  case ExecutionType.NonQuery:
                      return server.ConnectionContext.ExecuteNonQuery(sql);
                  case ExecutionType.Scalar:
                      return server.ConnectionContext.ExecuteScalar(sql);
                  case ExecutionType.Reader:
                      return server.ConnectionContext.ExecuteReader(sql);
              }
          }
          return null;
      }
  </code></pre>
  <p>I am currently getting  the error:
  Argument 1: cannot convert from 'System.Data.SqlClient.SqlConnection' to 'Microsoft.SqlServer.Management.Common.IRenewableToken'</p>
  <p>the particular line is</p>
  <pre><code> var server = new Server(new ServerConnection(connection));
  </code></pre>
  <p>The ServerConnection Class seem to expect a parameter of IRenewableToken but it has constructor that accepts a SqlConnection parameter.</p>
  <p>I am not sure what I missing I beleive I have the correct NugetPackages and have the following using statements</p>
  <pre><code>using Microsoft.SqlServer.Management.Common;
  using Microsoft.SqlServer.Management.Smo;
  </code></pre>
  <p>Any ideas on what I am missing here?</p>