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); }
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); }
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); }
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); }
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); }
// *** 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; }