예제 #1
0
        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
                                 ));
            }
        }
예제 #2
0
        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
                                     ));
                }
            }
        }
예제 #3
0
        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);
        }