public static IServiceCollection AddFromAssembly(this IServiceCollection serviceCollection, Assembly assembly)
        {
            var builder = new ServiceDescriptorsBuilder().AddSourceAssembly(assembly);
            BuildAndFill(serviceCollection, builder);

            return serviceCollection;
        }
        private static void BuildAndFill(IServiceCollection serviceCollection, ServiceDescriptorsBuilder builder)
        {
            builder.AddTypesProvider(new ExistingServiceCollectionTypesProvider(serviceCollection));
            var serviceDescriptors = builder.Build();

            MergeServiceDescriptions(serviceCollection, serviceDescriptors);
        }
Exemple #3
0
        private static void BuildAndFill(IServiceCollection serviceCollection, ServiceDescriptorsBuilder builder)
        {
            builder.AddTypesProvider(new ExistingServiceCollectionTypesProvider(serviceCollection));
            var serviceDescriptors = builder.Build();

            MergeServiceDescriptions(serviceCollection, serviceDescriptors);
        }
Exemple #4
0
        private static ServiceDescriptorsBuilder Builder(string namespaceEndWith = "TestServices")
        {
            var assembly = GetTestAssembly();
            var builder  = new ServiceDescriptorsBuilder().AddSourceAssembly(assembly);

            return(builder.AddTypesConvention(new NamespaceEndWithTestServicesConvention(namespaceEndWith)));
        }
Exemple #5
0
        public static IServiceCollection AddFromAssembly(this IServiceCollection serviceCollection, Assembly assembly)
        {
            var builder = new ServiceDescriptorsBuilder().AddSourceAssembly(assembly);

            BuildAndFill(serviceCollection, builder);

            return(serviceCollection);
        }
Exemple #6
0
        public void Builder_works_correct_even_when_there_is_not_assembly_definied()
        {
            // Arrange
            var builder = new ServiceDescriptorsBuilder();

            // Act
            builder.Build();
        }