Ejemplo n.º 1
0
        /// <summary>
        /// close all references as an asynchronous operation.
        /// </summary>
        /// <param name="correlationId">a unique transaction id to trace calls across components</param>
        /// <returns>Task.</returns>
        public async Task CloseAsync(string correlationId)
        {
            var components = _references.GetAll();
            await Closer.CloseAsync(correlationId, components);

            Referencer.UnsetReferences(components);

            _references.Clear();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Closes component and frees used resources.
        /// </summary>
        /// <param name="correlationId">(optional) transaction id to trace execution through call chain.</param>
        public async Task CloseAsync(string correlationId)
        {
            if (_opened)
            {
                var components = base.GetAll();
                await Closer.CloseAsync(correlationId, components);

                _opened = false;
            }
        }
        public override List <object> RemoveAll(object locator)
        {
            var components = base.RemoveAll(locator);

            if (CloseEnabled)
            {
                Closer.CloseAsync(null, components).Wait();
            }

            return(components);
        }