Exemplo n.º 1
0
        public async Task Startup(ServiceLocatorProvider locatorProvider,
            IDependencyContainer container,
            Action<IDependencyContainer> buildDependencies = null)
        {
            await CommenceStartup();

            //            var builder = new ContainerBuilder();

            using (container.StartUpdate())
            {
                // Build and application dependencies
                RegisterDependencies(container);

                buildDependencies?.Invoke(container);

                //// Perform registrations and build the container.
                //var container = builder.Build();

                await BuildCoreDependencies(container);
            }

            // Set the service locator to an AutofacServiceLocator.
            //var csl = new AutofacServiceLocator(container);
            //ServiceLocator.SetLocatorProvider(() => csl);
            ServiceLocator.SetLocatorProvider(locatorProvider);

            await CompleteStartup();
        }