hangfire, RecurringJob AddOrUpdate reflection call c#
<p>I call AddOrUpdate method from RecurringJob like that</p>

<pre><code>public override string StartWork()
{
        RecurringJob.AddOrUpdate&lt;SomeScenario&gt;(jobEntity.Name, x =&gt; x.Execute(jobEntity.Name), cron, TimeZoneInfo.Utc);
}
</code></pre>

<p>I need to rewrite this method, to reflection call.
I found proper method overload</p>

<pre><code>  MethodInfo addOrUpdate = typeof(RecurringJob).GetMethods().Where(x =&gt; x.Name == "AddOrUpdate" &amp;&amp; x.IsGenericMethod &amp;&amp; x.IsGenericMethodDefinition).Select(m =&gt; new
        {
            Method = m,
            Params = m.GetParameters(),
            Args = m.GetGenericArguments()
        })
                 .Where(x =&gt; x.Params.Length == 5
                             &amp;&amp; x.Params[0].ParameterType == typeof(string)
                             &amp;&amp; x.Params[2].ParameterType == typeof(string)
                             &amp;&amp; x.Params[3].ParameterType == typeof(TimeZoneInfo)
                             &amp;&amp; x.Params[4].ParameterType == typeof(string)
                             )
                 .Select(x =&gt; x.Method).FirstOrDefault();
</code></pre>

<p>I Hold proper type in db, so I will get it like that</p>

<pre><code>Type type = Type.GetType(jobEntity.ScenarioType);
MethodInfo generic = addOrUpdate.MakeGenericMethod(type);
</code></pre>

<p>So, now I need to invoke this method with prooper parameters. </p>

<pre><code>public static void AddOrUpdate&lt;T&gt;(string recurringJobId, Expression&lt;Action&lt;T&gt;&gt; methodCall, string cronExpression, TimeZoneInfo timeZone = null, string queue = "default")
</code></pre>

<p>Problem: I don't know how to generate <code>Expression&lt;Action&lt;T&gt;&gt;</code> in this case, to invoke  <code>generic.Invoke(this, new object[] { jobEntity.Name,  Expression&lt;Action&lt;T&gt;&gt;, cron, TimeZoneInfo.Utc, null });</code></p>

<p>Thank you a lot, for any help.</p>