/// <summary>
        /// Add <see cref="IResourceService{T, TId}"/> implementations to container.
        /// </summary>
        /// <param name="assembly">The assembly to search for resources in.</param>
        public ServiceDiscoveryFacade AddServices(Assembly assembly)
        {
            var resourceDescriptors = TypeLocator.GetIdentifableTypes(assembly);

            foreach (var resourceDescriptor in resourceDescriptors)
            {
                AddServices(assembly, resourceDescriptor);
            }
            return(this);
        }
        /// <summary>
        /// Adds resources to the resourceGraph and registers <see cref="ResourceDefinition{T}"/> types on the container.
        /// </summary>
        /// <param name="assembly">The assembly to search for resources in.</param>
        public ServiceDiscoveryFacade AddResources(Assembly assembly)
        {
            var identifiables = TypeLocator.GetIdentifableTypes(assembly);

            foreach (var identifiable in identifiables)
            {
                AddResource(assembly, identifiable);
            }

            return(this);
        }
        /// <summary>
        /// Adds resources to the graph and registers <see cref="ResourceDefinition{T}"/> types on the container.
        /// </summary>
        /// <param name="assembly">The assembly to search for resources in.</param>
        /// <param name="resourceNameFormatter">The type name formatter used to get the string representation of resource names.</param>
        public ServiceDiscoveryFacade AddAssemblyResources(Assembly assembly, IResourceNameFormatter resourceNameFormatter = null)
        {
            var identifiables = TypeLocator.GetIdentifableTypes(assembly);

            foreach (var identifiable in identifiables)
            {
                RegisterResourceDefinition(assembly, identifiable);
                AddResourceToGraph(identifiable, resourceNameFormatter);
            }

            return(this);
        }
        /// <summary>
        /// Add resources, services and repository implementations to the container.
        /// </summary>
        /// <param name="assembly">The assembly to search for resources in.</param>
        public ServiceDiscoveryFacade AddAssembly(Assembly assembly)
        {
            AddDbContextResolvers(assembly);

            var resourceDescriptors = TypeLocator.GetIdentifableTypes(assembly);

            foreach (var resourceDescriptor in resourceDescriptors)
            {
                AddResource(assembly, resourceDescriptor);
                AddServices(assembly, resourceDescriptor);
                AddRepositories(assembly, resourceDescriptor);
            }
            return(this);
        }
        private ServiceDiscoveryFacade RegisterServiceImplementations(Assembly assembly, Type interfaceType)
        {
            var identifiables = TypeLocator.GetIdentifableTypes(assembly);

            foreach (var identifiable in identifiables)
            {
                var service = TypeLocator.GetGenericInterfaceImplementation(assembly, interfaceType, identifiable.ResourceType, identifiable.IdType);
                if (service.implementation != null)
                {
                    _services.AddScoped(service.registrationInterface, service.implementation);
                }
            }

            return(this);
        }