title: How can I manage my SQL query script in asp.net mvc project?
body: <p>I am using Dapper to process data.</p>
  <p>Here is a code sample:</p>
  <pre><code>using(var connection = new SqlConnection(ConfigurationManager.AppSettings[&quot;MyConnectString&quot;])
  {
       var sql = string.Format(
           @&quot;SELECT [Column1]
               FROM [MyTable]
              WHERE [Column3] &gt; {0}
                AND [Column4] &lt; {1}&quot;
           , myValue1
           , myValue2
       );
       var result = connection.Query&lt;long&gt;(sql).ToList();
  }
  </code></pre>
  <p>My project writes many sql scripts like the one above.</p>
  <p>I want to write scripts to files (maybe QueryAccount.config, QueryOrder.config, (xml format), or others)</p>
  <h2>Then I can load the script from the files.</h2>
  <p>What I want is write my scripts in files, then I write the same class
  in file. (eg. I write all query Product scripts in Product.config, and all query Order scripts in Order.config)
  Then I use like:</p>
  <pre><code>var cmd = MyCommandManager.GetScript(&quot;QueryProduct&quot;);
  cmd.SetParam(&quot;@ProductId&quot;, 123);
  cmd.SetParam(&quot;@InvoicingDate&quot;, DateTime.Now(-7))
  ...
  </code></pre>
  <p>Script in file like:</p>
  <pre><code>SELECT [ProductName]
  FROM [Product]
  WHERE [ProductId] = @ProductId
    AND [InvoicingDate] = @InvoicingDate
  </code></pre>