1 <?xml version="1.0" encoding="utf-8"?>
2 <Type Name="CreationPolicy" FullName="System.ComponentModel.Composition.CreationPolicy">
3 <TypeSignature Language="C#" Value="public enum CreationPolicy" />
4 <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed CreationPolicy extends System.Enum" />
6 <AssemblyName>System.ComponentModel.Composition</AssemblyName>
7 <AssemblyVersion>4.0.0.0</AssemblyVersion>
10 <BaseTypeName>System.Enum</BaseTypeName>
14 <attribution license="cc4" from="Microsoft" modified="false" />
15 <para>In the course of composition, the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> needs instances of the objects described by exports in order to fill imports. If a one export is used to fill multiple imports, there are two possible behaviors. Either a single instance of the exported object is created, and a reference to the same object is given to every importer, or a separate instance of the exported object is created for each importer. </para>
16 <para>Which behavior occurs depends on the <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> property of the <see cref="T:System.ComponentModel.Composition.PartCreationPolicyAttribute" /> attached to the export and the <see cref="P:System.ComponentModel.Composition.ImportAttribute.RequiredCreationPolicy" /> of the <see cref="T:System.ComponentModel.Composition.ImportAttribute" />. Both of which will contain a value from the <see cref="T:System.ComponentModel.Composition.CreationPolicy" /> enumeration. If the policies are incompatible, that export will not be considered a match for the given import. The following table summarizes the interaction of these two properties.</para>
22 <see cref="P:System.ComponentModel.Composition.ImportAttribute.RequiredCreationPolicy" />
26 <para>Export's <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> specifies <see cref="F:System.ComponentModel.Composition.CreationPolicy.Any" /> or none specified.</para>
29 <para>Export's <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> specifies <see cref="F:System.ComponentModel.Composition.CreationPolicy.Shared" /></para>
32 <para>Export's <see cref="P:System.ComponentModel.Composition.PartCreationPolicyAttribute.CreationPolicy" /> specifies <see cref="F:System.ComponentModel.Composition.CreationPolicy.NonShared" /></para>
39 <see cref="F:System.ComponentModel.Composition.CreationPolicy.Any" />
43 <para>A single, shared instance of the exported object will be created.</para>
46 <para>A single, shared instance of the exported object will be created.</para>
49 <para>A new instance of the exported object will be created for each importer.</para>
55 <see cref="F:System.ComponentModel.Composition.CreationPolicy.Shared" />
59 <para>A single, shared instance of the exported object will be created.</para>
62 <para>A single, shared instance of the exported object will be created.</para>
65 <para>The export will not be considered a match for the import.</para>
71 <see cref="F:System.ComponentModel.Composition.CreationPolicy.NonShared" />
75 <para>A new instance of the exported object will be created for each importer.</para>
78 <para>The export will not be considered a match for the import.</para>
81 <para>A new instance of the exported object will be created for each importer.</para>
87 <attribution license="cc4" from="Microsoft" modified="false" />
88 <para>Specifies when and how a part will be instantiated.</para>
92 <Member MemberName="Any">
93 <MemberSignature Language="C#" Value="Any" />
94 <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy Any = int32(0)" />
95 <MemberType>Field</MemberType>
97 <AssemblyVersion>4.0.0.0</AssemblyVersion>
100 <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType>
104 <attribution license="cc4" from="Microsoft" modified="false" />
105 <para>Specifies that the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> will use the most appropriate <see cref="T:System.ComponentModel.Composition.CreationPolicy" /> for the part given the current context. This is the default <see cref="T:System.ComponentModel.Composition.CreationPolicy" />. By default, <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> will use <see cref="F:System.ComponentModel.Composition.CreationPolicy.Shared" />, unless the <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> or importer requests <see cref="F:System.ComponentModel.Composition.CreationPolicy.NonShared" />.</para>
109 <Member MemberName="NewScope">
110 <MemberSignature Language="C#" Value="NewScope" />
111 <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy NewScope = int32(3)" />
112 <MemberType>Field</MemberType>
114 <AssemblyVersion>4.0.0.0</AssemblyVersion>
117 <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType>
120 <summary>To be added.</summary>
123 <Member MemberName="NonShared">
124 <MemberSignature Language="C#" Value="NonShared" />
125 <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy NonShared = int32(2)" />
126 <MemberType>Field</MemberType>
128 <AssemblyVersion>4.0.0.0</AssemblyVersion>
131 <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType>
135 <attribution license="cc4" from="Microsoft" modified="false" />
136 <para>Specifies that a new non-shared instance of the associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> will be created by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> for every requestor.</para>
140 <Member MemberName="Shared">
141 <MemberSignature Language="C#" Value="Shared" />
142 <MemberSignature Language="ILAsm" Value=".field public static literal valuetype System.ComponentModel.Composition.CreationPolicy Shared = int32(1)" />
143 <MemberType>Field</MemberType>
145 <AssemblyVersion>4.0.0.0</AssemblyVersion>
148 <ReturnType>System.ComponentModel.Composition.CreationPolicy</ReturnType>
152 <attribution license="cc4" from="Microsoft" modified="false" />
153 <para>Specifies that a single shared instance of the associated <see cref="T:System.ComponentModel.Composition.Primitives.ComposablePart" /> will be created by the <see cref="T:System.ComponentModel.Composition.Hosting.CompositionContainer" /> and shared by all requestors.</para>