public ActionResult <Object> CallMethod([FromBody] TypeLoadEntity entity) { typeLoadValidator.validate(entity); var resp = context.CallMethod(entity); return(resp); }
private Assembly getDll(TypeLoadEntity entity) { Assembly dll; if (!dlls.TryGetValue(entity.DllName, out dll)) { throw new Common.Exceptions.DllNotFoundException(string.Format("Dll {0} not found", entity.DllName)); } return(dll); }
private static Type getClass(TypeLoadEntity entity, Assembly dll) { Type classType = dll.GetType(entity.FullClassName); if (classType == null) { throw new ClassNotFoundException(entity.FullClassName); } return(classType); }
private object TryToCallMethod(TypeLoadEntity entity, object obj, Type type) { var method = GetMethod(entity.MethodArgs, type, entity.MethodName); List <object> args = new List <object>(); foreach (var item in entity.MethodArgs) { args.Add(TryToInit(item, false)); } return(method.Invoke(obj, args.ToArray())); }
public object CallMethod(TypeLoadEntity entity) { var obj = TryToInit(entity, true); return(TryToCallMethod(entity, obj, obj.GetType())); }