title: Pass parameter to function via reflection
body: <p>I have an extesion method with the following signature</p>
  
  <pre><code>public static void AddConfiguration&lt;TEntity&gt;(this ModelBuilder builder, EntityTypeConfiguration&lt;TEntity&gt; configuration)
      where TEntity : class
  {
      ...
  }
  </code></pre>
  
  <p>I want to pass the parameter via Reflection and tried this method:</p>
  
  <pre><code>var ctors = type.GetConstructors(BindingFlags.Public);
  modelBuilder.AddConfiguration(ctors[0].Invoke(new object[] { }));
  </code></pre>
  
  <p>And this way:</p>
  
  <pre><code>modelBuilder.AddConfiguration(Activator.CreateInstance(type));
  </code></pre>
  
  <p>The classes I'm getting from reflection are like these:</p>
  
  <pre><code>public class LessonMapping : EntityTypeConfiguration&lt;Lesson&gt; 
  public class ChapterMapping : EntityTypeConfiguration&lt;Chapter&gt; 
  public class TrainingMapping : EntityTypeConfiguration&lt;Training&gt; 
  </code></pre>
  
  <p>Both return an <code>object</code> so the method does not accept them. Is there any way to do that?</p>