private Dictionary <TerminalTypes, Dictionary <string, IRuleGrammarTerminal> > GetRuleTerminals(IRuleGrammarTerminalApplicationService ruleGrammarTerminalApplicationService) { try { var result = ruleGrammarTerminalApplicationService.GetAllAsync().Result; if (!result.IsSuccessful) { throw new InvalidOperationException("Unable to load grammar terminals"); } return(result.Content .GroupBy(x => x.TerminalType) .ToDictionary(x => x.Key, x => x.ToDictionary(t => t.Keyword, t => t))); } catch (Exception e) { _logManager.LogError(e, "BuslnessRuleParser.GetRuleTerminals"); throw; } }
public BusinessRuleParser(ILogManager logManager, IRuleGrammarTerminalApplicationService ruleGrammarTerminalApplicationService) { _logManager = logManager; _terminalCache = GetRuleTerminals(ruleGrammarTerminalApplicationService); }