private static Func<LogicalCallContext> LogicalCallContextBuilder()
{
var type = typeof(LogicalCallContext);
var ctor = type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null);
var creator = new DynamicMethod("CreateLogicalContext", type, null, type, true);
var generator = creator.GetILGenerator();
generator.Emit(OpCodes.Newobj, ctor);
generator.Emit(OpCodes.Ret);
return (Func<LogicalCallContext>)creator.CreateDelegate(typeof(Func<LogicalCallContext>));
}
}