1 // -----------------------------------------------------------------------
\r
2 // Copyright (c) Microsoft Corporation. All rights reserved.
\r
3 // -----------------------------------------------------------------------
\r
5 using Microsoft.Internal;
\r
6 using System.ComponentModel.Composition.Primitives;
\r
8 namespace System.ComponentModel.Composition
\r
10 public class ExportFactory<T>
\r
12 private Func<Tuple<T, Action>> _exportLifetimeContextCreator;
\r
14 public ExportFactory(Func<Tuple<T, Action>> exportLifetimeContextCreator)
\r
16 if (exportLifetimeContextCreator == null)
\r
18 throw new ArgumentNullException("exportLifetimeContextCreator");
\r
21 this._exportLifetimeContextCreator = exportLifetimeContextCreator;
\r
24 public ExportLifetimeContext<T> CreateExport()
\r
26 Tuple<T, Action> untypedLifetimeContext = this._exportLifetimeContextCreator.Invoke();
\r
27 return new ExportLifetimeContext<T>(untypedLifetimeContext.Item1, untypedLifetimeContext.Item2);
\r