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