Пример #1
0
        public void AppendServices(IServiceCollection services)
        {
            lock (_familyLock)
            {
                var(registry, scanners) = ScanningExploder.ExplodeSynchronously(services);

                Scanners = Scanners.Union(scanners).ToArray();

                registry
                .Where(x => !x.ServiceType.HasAttribute <LamarIgnoreAttribute>())

                .GroupBy(x => x.ServiceType)
                .Each(group =>
                {
                    if (_families.ContainsKey(group.Key))
                    {
                        var family = _families[group.Key];
                        if (family.Append(@group, DecoratorPolicies) == AppendState.NewDefault)
                        {
                            _byType = _byType.Remove(group.Key);
                        }
                    }
                    else
                    {
                        var family = buildFamilyForInstanceGroup(services, @group);
                        _families.Add(@group.Key, family);
                    }
                });

                buildOutMissingResolvers();

                rebuildReferencedAssemblyArray();
            }
        }
Пример #2
0
        public ServiceGraph(IServiceCollection services, Scope rootScope)
        {
            var(registry, scanners) = ScanningExploder.ExplodeSynchronously(services);

            Scanners = scanners;

            Services = registry;

            _rootScope = rootScope;

            organize(Services);
        }
Пример #3
0
        public static async Task <ServiceGraph> BuildAsync(IServiceCollection services, Scope rootScope)
        {
            var(registry, scanners) = await ScanningExploder.Explode(services);

            return(new ServiceGraph(registry, rootScope, scanners));
        }