Exemplo 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();
        }
        /// <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)
            {
                _opened = false;
                var components = base.GetAll();
                Referencer.UnsetReferences(components);
            }

            await Task.Delay(0);
        }
        /// <summary>
        /// Removes all component references that match the specified locator.
        /// </summary>
        /// <param name="locator">the locator to remove references by.</param>
        /// <returns>a list, containing all removed references.</returns>
        public override List <object> RemoveAll(object locator)
        {
            var components = base.RemoveAll(locator);

            if (_opened)
            {
                Referencer.UnsetReferences(components);
            }

            return(components);
        }