示例#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
                                     ));
                }
            }
        }