I will appreciate your help on the following 1. I need to display all exception messages that passed as a message with key value of a resource file and display the messages from the resource file. Example. throw new ApiException(Resources.ErrorMessages.AgreementDrawdownEnabled);
The above shall be displayed on module type. That means the display shall be like this Module Exception Message Order "Please provide the order description Customer "Customer age shall be more that 18 years"
In order to achieve that I need to take the input from the user as module name like , Customer/Order. I will have to get the traversal methods/call graphs of the module and from each and every module I have to check the existence of type apiException and its parameter. I know reflection is the only way for this but not clear how to to that.
Assembly assembly = Assembly.LoadFrom(@"...\Managers.dll"); var MyType = assembly.GetTypes().Where(t =>t.Name == "OrderManager").FirstOrDefault();
var targetMethod = MyType.GetMethods().Where(t => t.Name == "AdjustOrder").FirstOrDefault();
But I am clueless to get the creation of throw new ApiException within my targetMethod.
Thanks and regards Nilanjan Saha
Aucun commentaire:
Enregistrer un commentaire