/// <summary>
        /// Initializes a new instance of the <see cref="IsolatingComposablePartDefinition"/> class.
        /// </summary>
        /// <param name="sourcePart">The source part.</param>
        /// <param name="isolationMetadata">The isolation metadata.</param>
        public IsolatingComposablePartDefinition(ComposablePartDefinition sourcePart, IIsolationMetadata isolationMetadata)
        {
            if (sourcePart == null)
            {
                throw new ArgumentNullException("sourcePart");
            }

            this._sourcePart        = sourcePart;
            this._isolationMetadata = isolationMetadata;
        }
        /// <summary>
        /// Checks the metadata to see if isolation is required.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        /// <param name="isolationMetadata">The isolation metadata.</param>
        /// <returns>
        ///     <c>true</c> if isolation is required, otherwise <c>false</c>
        /// </returns>
        private static bool RequiresIsolation(IDictionary <string, object> metadata, out IIsolationMetadata isolationMetadata)
        {
            if (metadata.ContainsKey("Isolation"))
            {
                isolationMetadata = AttributedModelServices.GetMetadataView <IIsolationMetadata>(metadata);

                if (isolationMetadata != null && isolationMetadata.Isolation != IsolationLevel.None)
                {
                    return(true);
                }
            }

            isolationMetadata = null;

            return(false);
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IsolatingComposablePart"/> class.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="isolationMetadata">The isolation metadata.</param>
 public IsolatingComposablePart(ComposablePartDefinition definition, IIsolationMetadata isolationMetadata)
 {
     this._definition        = definition;
     this._values            = new Dictionary <ExportDefinition, object>();
     this._isolationMetadata = isolationMetadata;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DisposableIsolatingComposablePart"/> class.
 /// </summary>
 /// <param name="definition">The definition.</param>
 /// <param name="isolationMetadata">The isolation metadata.</param>
 public DisposableIsolatingComposablePart(ComposablePartDefinition definition, IIsolationMetadata isolationMetadata)
     : base(definition, isolationMetadata)
 {
 }