public void ServiceCallByAction(string serverName, string methodName, params object[] parameters) { var type = ReflectionUtils.GetTypeFromName(serverName); var service = IoC.Resolve(type); var jsonPars = System.Text.Json.JsonSerializer.Serialize(parameters); var newObjs = JsonHelper.ToObject <object[]>(jsonPars); ReflectionUtils.CallMethod(service, methodName, newObjs); }
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { try { result = ReflectionUtils.CallMethod(Instance, binder.Name, args); return(true); } catch {} result = null; return(false); }
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { // Implement most commonly used method if (binder.Name == "Read") { result = DataReader.Read(); } else if (binder.Name == "Close") { DataReader.Close(); result = null; } else { // call other DataReader methods using Reflection (slow - not recommended) // recommend you use full DataReader instance result = ReflectionUtils.CallMethod(DataReader, binder.Name, args); } return(true); }