public static void RegisterLifetimeFactory(string lifetime, ILifetimeFactory lifetimeFactory) { CheckIsNotNullEmptyOrWhitespace(nameof(lifetime), lifetime); CheckIsNotNull(nameof(lifetimeFactory), lifetimeFactory); _lifetimes.AddOrUpdate(lifetime, lt => lifetimeFactory, (lt, olf) => lifetimeFactory); }
public LoggingLifetimeFactory(string lifetime, ILifetimeFactory innerLifetimeFactory, Func <object> factory) { Preconditions.CheckIsNotNullEmptyOrWhitespace(nameof(lifetime), lifetime); Preconditions.CheckIsNotNull(nameof(innerLifetimeFactory), innerLifetimeFactory); _lifetime = lifetime; _innerLifetimeFactory = innerLifetimeFactory; }
public LoggingLifetimeScope(string lifetime) { Preconditions.CheckIsNotNullEmptyOrWhitespace(nameof(lifetime), lifetime); _lifetime = lifetime; _previousLifetimeFactory = Lifetimes.GetLifetimeFactory(lifetime); var loggingLifetimeFactory = new LoggingLifetimeFactory(lifetime, _previousLifetimeFactory, null); Lifetimes.RegisterLifetimeFactory(lifetime, loggingLifetimeFactory); }