public IEnumerable <App> Create() { foreach (var type in AppTypeProvider.GetTypes()) { var attribute = CustomAttributeExtensions.GetCustomAttribute <AppAttribute>(type); var translationAttribute = CustomAttributeExtensions.GetCustomAttribute <TranslationsAttribute>(type); var translations = translationAttribute != null?TranslationRepositoryCreator.Create(translationAttribute.Path) : new EmptyTranslationRepository(); yield return(new App( attribute.Id, scripts: ScriptCreator.Create(type), styles: StyleCreator.Create(type), translations: translations )); } }
public IEnumerable <App> Create() { foreach (var component in ComponentRepository.GetAll()) { foreach (var type in AppTypeProvider.GetTypes(component)) { var attribute = CustomAttributeExtensions.GetCustomAttribute <AppAttribute>(type); var translationAttribute = CustomAttributeExtensions.GetCustomAttribute <TranslationsAttribute>(type); var translations = translationAttribute != null?TranslationRepositoryCreator.Create(component.Id + "/" + translationAttribute.Path) : new EmptyTranslationRepository(); yield return(new App( attribute.Id, component, scripts: ScriptCreator.Create(component.Id, type), styles: StyleCreator.Create(component.Id, type), resources: ResourceCreator.Create(component.Id, type), translations: translations )); } } }
public IEnumerable <Component> Create() { var result = new List <Component>(); foreach (var type in ComponentTypeProvider.GetTypes()) { var attribute = type.GetCustomAttribute <ComponentAttribute>(); if (attribute == null) { continue; } result.Add(new Component(attribute.Id, new AssemblyWrapper(type.Assembly), ComponentDependencyCreator.Create(type), ComponentControllerCreator.Create(type), ScriptCreator.Create(attribute.Id, type), StyleCreator.Create(attribute.Id, type), ResourceCreator.Create(attribute.Id, type))); } if (Logger.IsEnabled(LogLevel.Information)) { Logger.LogInformation($"Detected {result.Count} components: {string.Join(", ", result.Select(r => r.Id))}"); } return(result); }