100
100
[string []]$EventName ,
101
101
102
102
# The default display.
103
- # If only one propertry is used, this will set the default display property.
104
- # If more than one property is used, this will set the default display member set.
103
+ # This is the default set of properties to display if no formatter is specified.
105
104
[string []]$DefaultDisplay ,
106
105
106
+ # The default key property set.
107
+ # This is the set of properties that will be used as the key for the object.
108
+ [string []]$DefaultKey ,
109
+
107
110
# The ID property
108
111
[string ]$IdProperty ,
109
112
@@ -250,6 +253,7 @@ if (`$Eventhandler -is [Management.Automation.PSEventSubscriber]) {
250
253
if ($psBoundParameters.ContainsKey (' SerializationDepth' ) -or
251
254
$psBoundParameters.ContainsKey (' IdProperty' ) -or
252
255
$psBoundParameters.ContainsKey (' DefaultDisplay' ) -or
256
+ $psBoundParameters.ContainsKey (' DefaultKey' ) -or
253
257
$psBoundParameters.ContainsKey (' Reserializer' )) {
254
258
$defaultDisplayXml = if ($psBoundParameters.ContainsKey (' DefaultDisplay' )) {
255
259
if ($DebugBuild ) {
@@ -263,6 +267,20 @@ if (`$Eventhandler -is [Management.Automation.PSEventSubscriber]) {
263
267
$referencedProperties
264
268
</ReferencedProperties>
265
269
</PropertySet>
270
+ "
271
+ }
272
+ $defaultKeyXml = if ($psBoundParameters.ContainsKey (' DefaultKey' )) {
273
+ if ($DebugBuild ) {
274
+ Update-TypeData @updateSplat - DefaultKeyPropertySet $DefaultKey
275
+ }
276
+ $referencedProperties = " <Name>" + ($DefaultKey -join " </Name>
277
+ <Name>" ) + " </Name>"
278
+ " <PropertySet>
279
+ <Name>DefaultKeyPropertySet</Name>
280
+ <ReferencedProperties>
281
+ $referencedProperties
282
+ </ReferencedProperties>
283
+ </PropertySet>
266
284
"
267
285
}
268
286
$serializationDepthXml = if ($psBoundParameters.ContainsKey (' SerializationDepth' )) {
@@ -293,9 +311,14 @@ if (`$Eventhandler -is [Management.Automation.PSEventSubscriber]) {
293
311
<MemberSet>
294
312
<Name>PSStandardMembers</Name>
295
313
<Members>
296
- $defaultDisplayXml
297
- $serializationDepthXml
298
- $reserializerXml
314
+ $ (
315
+ @ (
316
+ $defaultDisplayXml
317
+ $DefaultKeyXml
318
+ $serializationDepthXml
319
+ $reserializerXml
320
+ ) -ne $null -join [Environment ]::NewLine
321
+ )
299
322
</Members>
300
323
</MemberSet>
301
324
"
0 commit comments