public IList <SagaDefinition> GetSagas(Action <string, string> logger = null) { var sagas = new List <SagaDefinition>(); var errors = new List <Exception>(); foreach (var type in module.AllClasses()) { try { if (SagaDefinitionReader.TryGetSagaDefinition(type, out var definition)) { sagas.Add(definition); } } catch (ErrorsException exception) { logger?.Invoke(exception.Message, type.FullName); errors.Add(new Exception($"Error in '{type.FullName}' (Filename='{type.GetFileName()}'). Error: {exception.Message}", exception)); } } if (errors.Count > 0 && logger == null) { throw new AggregateException(errors); } return(sagas); }
private static void AddClasses(ModuleDefinition module, List <SymbolInformation> information) { foreach (var cs in ModuleDefinition.AllClasses(module.TopLevelDecls).Where(cl => !(cl.tok is IncludeToken))) { if (cs.Module != null && cs.tok != null) { var classSymbol = new SymbolInformation { Module = cs.Module.Name, Name = cs.Name, SymbolType = SymbolInformation.Type.Class, StartToken = cs.tok, EndToken = cs.BodyEndTok }; information.Add(classSymbol); } } }
public IEnumerable <SagaDefinition> GetSagas(Action <ErrorsException, TypeDefinition> logError) { var sagas = new List <SagaDefinition>(); foreach (var type in module.AllClasses()) { try { if (SagaDefinitionReader.TryGetSqlSagaDefinition(type, out var definition)) { sagas.Add(definition); } } catch (ErrorsException exception) { logError(exception, type); } } return(sagas); }