static CachedOperatorTypeLoader() { var allOperatorTypeLoader = new OperatorTypeLoader(); var types = allOperatorTypeLoader.LoadOperatorTypes(); var operators = types.Select(allOperatorTypeLoader.LoadOperator); _cachedTypes = _cachedTypes.AddRange(types); _cachedOperators = _cachedOperators.AddRange(operators); AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => { try { var operatorTypeLoader = new OperatorTypeLoader(); var newAssemblyTypes = operatorTypeLoader.LoadOperatorTypes(args.LoadedAssembly); var newOperators = newAssemblyTypes.Select(operatorTypeLoader.LoadOperator); _cachedTypes = _cachedTypes.AddRange(newAssemblyTypes); _cachedOperators = _cachedOperators.AddRange(newOperators); } catch (Exception e) { NLog.LogManager.GetCurrentClassLogger().Error(e, "Loading operators from a new assembly failed"); } }; }
public OperatorLoadingEquationSolver() { var types = new OperatorTypeLoader().LoadOperatorTypes(); DefaultSolver = new EquationSolver(types); }