title: SQL CLR Calling SqlFunction declared in parent class
body: <p>I have several classes to proceed some calculations.
  They can be called one at time from SqlServer, or in batch from Web Application.
  So I created base class to combine common logic</p>
  
  <pre class="lang-cs prettyprint-override"><code>public abstract class BaseClass&lt;T&gt; where T: BaseClass&lt;T&gt;, new()
  {
      [SqlFunction(DataAccess = DataAccessKind.Read, FillRowMethodName = "GetRow")]
      public static IEnumerable Calculate(int param1)
      {
          return new T().calc(param1);
      }
  
      public static void GetRow(Object obj, out int result)
      {
          // put some result
      }
  
      protected abstract IEnumerable calc(int param1);
  }
  
  public class Child1 : BaseClass&lt;Child1&gt;
  {
      protected override IEnumerable calc(int param1)
      {
          // return some result
      }
  }
  
  public class Child2 : BaseClass&lt;Child2&gt; ....
  </code></pre>
  
  <p>But when I try to create function in DB, like this:
  </p>
  
  <pre><code>create function sf_calc(@value int)
  returns table 
  (score int)
  as 
  external NAME &lt;assembly_name&gt;.[&lt;namespace&gt;.Child1].Calculate;
  go
  </code></pre>
  
  <p>I get error:</p>
  
  <pre><code>"Msg 6506, Level 16, State 1, Procedure sf_calc, Line 2
  Could not find method 'Calculate' for type 'Child1' in assembly '&lt;assembly_name&gt;'"
  </code></pre>
  
  <p>It seems like they forgot to include System.Reflection.BindingFlags.FlattenHierarchy while reflecting method by name</p>
  
  <p>Is there any way to workaround?</p>