DscResourcePropertyInfoInternal.cs (2165B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="DscResourcePropertyInfoInternal.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.Management.Configuration.Processor.PowerShell.DscResourcesInfo 8 { 9 using System; 10 using System.Collections.Generic; 11 12 /// <summary> 13 /// Contains a DSC resource property information. 14 /// </summary> 15 internal sealed class DscResourcePropertyInfoInternal 16 { 17 private const string DscResourcePropertyInfoFullName = "Microsoft.PowerShell.DesiredStateConfiguration.DscResourcePropertyInfo"; 18 19 /// <summary> 20 /// Initializes a new instance of the <see cref="DscResourcePropertyInfoInternal"/> class. 21 /// </summary> 22 /// <param name="dscPropertyInfo">Dynamic DSC property info.</param> 23 public DscResourcePropertyInfoInternal(dynamic dscPropertyInfo) 24 { 25 if (dscPropertyInfo.GetType().FullName != DscResourcePropertyInfoFullName) 26 { 27 throw new ArgumentException(); 28 } 29 30 this.Name = dscPropertyInfo.Name; 31 this.PropertyType = dscPropertyInfo.PropertyType; 32 this.IsMandatory = dscPropertyInfo.IsMandatory; 33 this.Values = dscPropertyInfo.Values; 34 } 35 36 /// <summary> 37 /// Gets or sets name of the property. 38 /// </summary> 39 public string Name { get; set; } 40 41 /// <summary> 42 /// Gets or sets type of the property. 43 /// </summary> 44 public string PropertyType { get; set; } 45 46 /// <summary> 47 /// Gets or sets a value indicating whether the property is mandatory or not. 48 /// </summary> 49 public bool IsMandatory { get; set; } 50 51 /// <summary> 52 /// Gets Values for a resource property. 53 /// </summary> 54 public List<string> Values { get; private set; } = new List<string>(); 55 } 56 }