Example #1
0
        public void Register(ILifetimeAware service)
        {
            if (service == null)
                throw new ArgumentNullException("service");

            if (registeredServices.Contains(service))
                throw new InvalidOperationException(ResourceHelper.GetErrorResource("Exception_InvalidOperation_CannotRegisterServiceMultipleTimes"));

            // Add the service to the internal list

            registeredServices.Add(service);
        }
Example #2
0
        public void Unregister(ILifetimeAware service)
        {
            // Validate parameters

            if (service == null)
                throw new ArgumentNullException("service");

            if (!registeredServices.Contains(service))
                throw new InvalidOperationException(ResourceHelper.GetErrorResource("Exception_InvalidOperation_CannotUnregisterUnregisteredService"));

            // Remove the service from the internal list

            registeredServices.Remove(service);
        }
Example #3
0
            public void Unregister(ILifetimeAware service)
            {
                if (service == null)
                {
                    throw new ArgumentNullException(nameof(service));
                }

                if (!_registeredServices.Contains(service))
                {
                    throw new InvalidOperationException(ResourceHelper.GetErrorResource("Exception_InvalidOperation_CannotUnregisterUnregisteredService"));
                }

                _registeredServices.Remove(service);
            }
Example #4
0
            public void Register(ILifetimeAware service)
            {
                if (service == null)
                {
                    throw new ArgumentNullException(nameof(service));
                }

                if (_registeredServices.Contains(service))
                {
                    throw new InvalidOperationException(ResourceHelper.GetErrorResource("Exception_InvalidOperation_CannotRegisterServiceMultipleTimes"));
                }

                _registeredServices.Add(service);
            }
Example #5
0
        public void Unregister(ILifetimeAware service)
        {
            // Validate parameters

            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            if (!registeredServices.Contains(service))
            {
                throw new InvalidOperationException(ResourceHelper.GetErrorResource("Exception_InvalidOperation_CannotUnregisterUnregisteredService"));
            }

            // Remove the service from the internal list

            registeredServices.Remove(service);
        }
Example #6
0
        // *** Methods ***

        public void Register(ILifetimeAware service)
        {
            // Validate parameters

            if (service == null)
            {
                throw new ArgumentNullException("service");
            }

            if (registeredServices.Contains(service))
            {
                throw new InvalidOperationException(ResourceHelper.GetErrorResource("Exception_InvalidOperation_CannotRegisterServiceMultipleTimes"));
            }

            // Add the service to the internal list

            registeredServices.Add(service);
        }
 public void Unregister(ILifetimeAware service)
 {
     RegisteredServices.Remove(service);
 }
        // *** Methods ***

        public void Register(ILifetimeAware service)
        {
            RegisteredServices.Add(service);
        }
        private TestableLifetimeManager CreateLifetimeManager(ILifetimeAware[] services)
        {
            TestableLifetimeManager lifetimeManager = new TestableLifetimeManager();

            foreach (ILifetimeAware service in services)
                lifetimeManager.Register(service);

            return lifetimeManager;
        }