Castle.MicroKernel.Lifestyle.Scoped.DefaultLifetimeScope.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
		public void Dispose()
		{
			var disposableCache = scopeCache as IDisposable;
			if (disposableCache != null)
			{
				disposableCache.Dispose();
			}
		}

Usage Example

Example #1
0
        public ILifetimeScope GetScope(CreationContext context)
        {
            var messageContext = MessageContext.Current;

            if (messageContext == null)
            {
                throw new InvalidOperationException(string.Format("Attempted to resolve {0} outside of Rebus message context!", context.RequestedType));
            }

            var items = messageContext.TransactionContext.Items;

            object lifetimeScope;

            if (items.TryGetValue(LifestimeScopeItemKey, out lifetimeScope))
            {
                return (ILifetimeScope) lifetimeScope;
            }

            var defaultLifetimeScope = new DefaultLifetimeScope();

            items[LifestimeScopeItemKey] = defaultLifetimeScope;

            messageContext.TransactionContext.OnDisposed(() => defaultLifetimeScope.Dispose());

            return defaultLifetimeScope;
        }
All Usage Examples Of Castle.MicroKernel.Lifestyle.Scoped.DefaultLifetimeScope::Dispose