title: Child static constructor not called when base member accessed
body: <p>I have a class defined as:</p>
  
  <pre><code>public class DatabaseEntity&lt;T&gt; where T : DatabaseEntity&lt;T&gt; {
      public static string Query { get; protected set; }
      public static IList&lt;T&gt; Load() {
          return Database.Get(Query);
      }
  }
  
  public class Node : DatabaseEntity&lt;Node&gt; {
      static Node() {
          Node.Query = @"SELECT Id FROM Node";
      }
  }
  </code></pre>
  
  <p>When I run <code>Node.Load()</code> from a codebehind (<code>Window.xaml.cs</code>) the Node's static constructor never fires; or at least doesn't hit a breakpoint and does not set Node.Query to anything other than null.</p>
  
  <p>Is there any reason why this might occur?</p>
  
  <p><strong>Solution</strong></p>
  
  <p>Check out the answers below for a few solutions. For my case, I decided to simply make the <code>Query</code> variable public, and set all instances of <code>Query</code> in one place. (Not ideal, but it works.)</p>