Ejemplo n.º 1
0
        private void buildImports(TypeStructure typeStructure)
        {
            var imports = TypeExtractor.GetTypes(typeStructure);

            multiplyTags(imports.Count, ((JSRenderble)DI.Get <IImport>(typeStructure)).Name);
            childRenderbles.AddRange(imports.Select(importTypeStructure => (JSRenderble)DI.Get <IImport>(importTypeStructure)));
        }
Ejemplo n.º 2
0
        private void buildImports(ClassStructure classStructure)
        {
            var imports = TypeExtractor.GetTypes(classStructure);

            multiplyTags(imports.Count, ((JSRenderble)DI.Get <IRequestContextImport>()).Name);
            childRenderbles.AddRange(imports.Select(importTypeStructure => (JSRenderble)DI.Get <IRequestContextImport>(importTypeStructure)));
        }
Ejemplo n.º 3
0
        public ExportRequestContext(ClassStructure classStructure) : base("ExportRequestContext")
        {
            var exportClasses = TypeExtractor.GetTypes(classStructure).Select(x => Configuration.Instance.ModelsNameFactory(x.TypeName)).ToList();

            exportClasses.Add(classStructure.Name);
            tagValues = new Dictionary <string, string> {
                { typesTag, exportClasses.Aggregate((a, b) => $"{a},{b}") }
            };
        }
Ejemplo n.º 4
0
        public void TypeExtractorMustListTypesFromGivenAssembly()
        {
            Assembly targetAssembly = typeof(SampleClass).Assembly;

            ITypeExtractor     extractor = new TypeExtractor();
            IEnumerable <Type> results   = extractor.GetTypes(targetAssembly);

            Assert.IsNotNull(results);
            Assert.IsTrue(results.Count() > 0);
        }
Ejemplo n.º 5
0
        public void TypeExtractorMustListTypesFromGivenAssembly()
        {
            var targetAssembly = typeof(SampleClass).Assembly;

            ITypeExtractor extractor = new TypeExtractor();
            var            results   = extractor.GetTypes(targetAssembly);

            Assert.NotNull(results);
            Assert.True(results.Count() > 0);
        }
Ejemplo n.º 6
0
        public void AddExtensionMethodsFrom(Assembly extensionAssembly)
        {
            var extensionAttributeType = typeof(ExtensionAttribute);

            // Scan the target assembly for extension methods that pertain to the current type
            var typeExtractor = new TypeExtractor();
            var loadedTypes   = typeExtractor.GetTypes(extensionAssembly);

            // Add every extension method inside that assembly
            var bindingFlags     = BindingFlags.Public | BindingFlags.Static;
            var extensionMethods = loadedTypes.SelectMany(t => t.GetMethods(bindingFlags))
                                   .Where(m => m.GetCustomAttributes(extensionAttributeType, false).Any());

            _extensionMethodPool.AddRange(extensionMethods);
        }