public static T Create <T>(ViewResolver viewResolver, ExceptionReportInfo reportInfo) where T : class { Type view = viewResolver.Resolve <T>(); ConstructorInfo constructor = view.GetConstructor(new[] { typeof(ExceptionReportInfo) }); object newInstance = constructor.Invoke(new object[] { reportInfo }); return(newInstance as T); }
/// <summary> /// Initialise the ExceptionReporter /// <remarks>readConfig() should be called (explicitly) if you need to override default config settings</remarks> /// </summary> public ExceptionReporter() { Assembly callingAssembly = Assembly.GetCallingAssembly(); _reportInfo = new ExceptionReportInfo { AppAssembly = callingAssembly }; _viewResolver = new ViewResolver(callingAssembly); _internalExceptionView = ViewFactory.Create <IInternalExceptionView>(_viewResolver); }
public static T Create <T>(ViewResolver viewResolver) where T : class { return(Activator.CreateInstance(viewResolver.Resolve <T>()) as T); }