ExportFactory<T> Classe

Definição

Uma fábrica que cria novas instâncias de uma parte que fornece a exportação especificada.A factory that creates new instances of a part that provides the specified export.

generic <typename T>
public ref class ExportFactory
public class ExportFactory<T>
type ExportFactory<'T> = class
Public Class ExportFactory(Of T)

Parâmetros de tipo

T

O tipo de exportação.The type of the export.

Herança
ExportFactory<T>
Derivado

Comentários

Quando você faz referência indiretamente a uma parte usando um Lazy<T> objeto, a Value propriedade sempre retorna uma referência ao mesmo objeto.When you refer indirectly to a part by using a Lazy<T> object, the Value property always returns a reference to the same object. Em algumas circunstâncias, talvez você queira que cada referência resulte na criação de um novo objeto.In some circumstances, you might want each reference to result in the creation of a new object. ExportFactory<T>é projetado para esses cenários.ExportFactory<T> is designed for those scenarios.

ExportFactory<T>pode ser usado de maneira semelhante ao Lazy<T> criar partes atribuídas.ExportFactory<T> can be used in a similar fashion to Lazy<T> when creating attributed parts. Ou seja, um contrato de importação definido em ExportFactory<T> com um parâmetro genérico de T será compatível com uma exportação definida em T .That is, an import contract that is defined on ExportFactory<T> with a generic parameter of T will match an export that is defined on T. Por exemplo, a seguinte correspondência de exportação e importação:For example, the follow export and import match:

[Export]  
public String myData = "Example Data.";  

[Import]  
public ExportFactory<String> theData { get; set; }  
<Export()>  
Public myData As String = "Example Data."  

<Import()>  
Public Property theData As ExportFactory(Of String)  

O ExportFactory<T>.CreateExport método retorna um ExportLifetimeContext<T> objeto, que tem duas partes.The ExportFactory<T>.CreateExport method returns an ExportLifetimeContext<T> object, which has two pieces. A ExportLifetimeContext<T>.Value propriedade fornece acesso à parte criada.The ExportLifetimeContext<T>.Value property provides access to the created part. Chamar o Dispose método do ExportLifetimeContext<T> objeto limpa a parte criada e todas as suas dependências, permitindo assim que o tempo de vida da parte seja gerenciado sem referência ao contêiner que o criou.Calling the Dispose method of the ExportLifetimeContext<T> object cleans up the created part and all of its dependencies, thereby allowing the part's lifetime to be managed without reference to the container that created it.

Construtores

ExportFactory<T>(Func<Tuple<T,Action>>)

Inicializa uma nova instância da classe ExportFactory<T>.Initializes a new instance of the ExportFactory<T> class.

Métodos

CreateExport()

Cria uma instância do tipo de exportação da fábrica.Creates an instance of the factory's export type.

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
OnFilterScopedCatalog(ComposablePartDefinition)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Aplica-se a