Services() public method

public Services ( ) : IEnumerable
return IEnumerable
        public IDisposable Load()
        {
            var facility = new BottlesServicePackageFacility();

            PackageRegistry.LoadPackages(x => x.Facility(facility));
            PackageRegistry.AssertNoFailures();

            _services = facility.Services();
            if (!_services.Any())
            {
                throw new ApplicationException("No services were detected.  Shutting down.");
            }

            var tasks = _services.Select(x => x.ToTask()).ToArray();

            _services.Each(x => EventAggregator.Messaging.AddListener(x));

            tasks.Each(x => x.Start());

            Task.WaitAll(tasks);

            return this;
        }
Beispiel #2
0
        public IDisposable Load()
        {
            var facility = new BottlesServicePackageFacility();

            PackageRegistry.LoadPackages(x => x.Facility(facility));
            PackageRegistry.AssertNoFailures();

            _services = facility.Services();
            if (!_services.Any())
            {
                throw new ApplicationException("No services were detected.  Shutting down.");
            }

            var tasks = _services.Select(x => x.ToTask()).ToArray();

            _services.Each(x => EventAggregator.Messaging.AddListener(x));

            tasks.Each(x => x.Start());

            Task.WaitAll(tasks);

            return(this);
        }