Exemplo n.º 1
0
        public GenerationSpec GetGenerationSpec(Type type)
        {
            Requires.NotNull(type, nameof(type));

            var metadataReader = new AttributeMetadataReader();
            var generationSpec = new GenerationSpecProviderGenerationSpec();

            TypeSpec typeSpec = GetTypeSpec(type, metadataReader);

            generationSpec.TypeSpecs.Add(type, typeSpec);

            return(generationSpec);
        }
Exemplo n.º 2
0
        public GenerationSpec GetGenerationSpec(IEnumerable <Assembly> assemblies)
        {
            Requires.NotNull(assemblies, nameof(assemblies));

            var metadataReader = new AttributeMetadataReader();
            var generationSpec = new GenerationSpecProviderGenerationSpec();

            foreach (Assembly assembly in assemblies)
            {
                IEnumerable <Type> types = assembly.GetLoadableTypes()
                                           .GetExportMarkedTypes(metadataReader);

                foreach (Type type in types)
                {
                    TypeSpec typeSpec = GetTypeSpec(type, metadataReader);
                    generationSpec.TypeSpecs.Add(type, typeSpec);
                }
            }

            return(generationSpec);
        }