title: How to call static method from ASP.NET MVC controller in C#
body: <p>GetMethod does not find public static method if called from ASP .NET MVC controller.
  (From console application it work OK).</p>
  
  <p>To solve this dummy <code>SaveEntityGenericWrapper</code> method is used.</p>
  
  <p>How to remove <code>SaveEntityGenericWrapper</code> from code ?</p>
  
  <p>Why <code>GetMethod("SaveEntityGeneric")</code> returns <code>null</code> but <code>GetMethod("SaveEntityGenericWrapper")</code> works
  if called from ASP .NET MVC 2 controller ?</p>
  
  <p>How to make <code>SaveEntityGeneric</code> private if partial trust is used in MVC2 ?</p>
  
  <pre><code>public class EntityBase() {
  
      public void SaveEntity(EntityBase original)
      { 
          var method = GetType().GetMethod("SaveEntityGenericWrapper");
          // why this line returns null if called from ASP .NET MVC 2 controller:
          // method = GetType().GetMethod("SaveEntityGeneric");
          var gm = method.MakeGenericMethod(GetType());
          gm.Invoke(this, new object[] { original, this });
      }
  
      // Dummy wrapper reqired for mvc reflection call only. 
      // How to remove it?
      public List&lt;IList&gt; SaveEntityGenericWrapper&lt;TEntity&gt;(TEntity original, TEntity modified)
          where TEntity : EntityBase, new()
      {
          return SaveEntityGeneric&lt;TEntity&gt;(original, modified);
      }
  
      public static List&lt;IList&gt; SaveEntityGeneric&lt;TEntity&gt;(TEntity original, TEntity modified)
                  where TEntity : EntityBase, new()
      { ... actual work is performed here  }
  }
  </code></pre>