Ejemplo n.º 1
0
        public static void RegisterLifetimeFactory(string lifetime, ILifetimeFactory lifetimeFactory)
        {
            CheckIsNotNullEmptyOrWhitespace(nameof(lifetime), lifetime);
            CheckIsNotNull(nameof(lifetimeFactory), lifetimeFactory);

            _lifetimes.AddOrUpdate(lifetime, lt => lifetimeFactory,
                                   (lt, olf) => lifetimeFactory);
        }
Ejemplo n.º 2
0
        public LoggingLifetimeFactory(string lifetime, ILifetimeFactory innerLifetimeFactory, Func <object> factory)
        {
            Preconditions.CheckIsNotNullEmptyOrWhitespace(nameof(lifetime), lifetime);
            Preconditions.CheckIsNotNull(nameof(innerLifetimeFactory), innerLifetimeFactory);

            _lifetime             = lifetime;
            _innerLifetimeFactory = innerLifetimeFactory;
        }
Ejemplo n.º 3
0
        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);
        }