Example #1
0
        private static void OnAppStart(IWebHost webHost)
        {
            using (var scope = webHost.Services.CreateScope())
            {
                var serviceProvider = scope.ServiceProvider;

                IBootstrapperService bootstrapperService = serviceProvider.GetService <IBootstrapperService>();

                bootstrapperService.InitialAsync().Wait();
            }
        }
Example #2
0
        /// <summary>
        /// Add a service to the collection of bootstrapped services.
        /// </summary>
        /// <param name="service">Service.</param>
        public Bootstrapper AddService(IBootstrapperService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            if (_strict && !service.ServiceType.In(BootstrapperServiceType.Bus, BootstrapperServiceType.Other))
            {
                var currentService = _services.Find(s => s.ServiceType == service.ServiceType);
                if (currentService != null)
                {
                    throw new InvalidOperationException($"Bootstrapper.AddService() : A service of type {service.ServiceType} has already been added." +
                                                        $"Current registered service : {currentService.GetType().FullName}");
                }
            }
            _services.Add(service);
            return(this);
        }
Example #3
0
 public BootStrapper(IBootstrapperService service)
 {
     _service = service;
     _service.ModelChanged += DBModelChanged;
 }