示例#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);
        }
        public LoggingLifetimeFactory(string lifetime, ILifetimeFactory innerLifetimeFactory, Func <object> factory)
        {
            Preconditions.CheckIsNotNullEmptyOrWhitespace(nameof(lifetime), lifetime);
            Preconditions.CheckIsNotNull(nameof(innerLifetimeFactory), innerLifetimeFactory);

            _lifetime             = lifetime;
            _innerLifetimeFactory = innerLifetimeFactory;
        }
示例#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);
        }