public static Task <bool> InvokeGenericSaveMethod(this PostModelRequest request, string methodName, BaseModelClass item, IContextRepository contextRepository) => (Task <bool>)request .GetGenericMethod(methodName) .Invoke(null, new object[] { item, contextRepository });
private static MethodInfo GetGenericMethod(this PostModelRequest request, string methodName) => methodName.GetMethod().MakeGenericMethod ( typeof(BaseModelClass).GetTypeInfo().Assembly.GetType(request.ModelType), typeof(BaseDataClass).GetTypeInfo().Assembly.GetType(request.DataType) );