- ControlType contains the values in the reference.
- EntityControlAttribute derives from Attribute and its constructors assign ControlType and Description.
- The required product properties are decorated with appropriate control metadata.
11.2 Assignment
Attributes
Work through the stories in order. Use the acceptance criteria to check each feature, and complete the nested tasks using the specified names, values, and scenarios.
11.2 Assignment Start.zip
11.2 Assignment Start.zipGo through each of the classes in the Products folder and add custom attributes of type EntityControlAttribute to each property. Pass in a ControlType and a description (if the name can be cleaned up) for each one.
Read all of the attributes of the specified type from the passed in memberInfo by calling GetCustomAttributes. Pass in the attributeType and false as arguments. Store the result in an array of attributes.
Assign an attribute variable to the first attribute.
Get the property from the attribute and store it in a variable.
If the property is found, get the value from the property and store it in the result variable.
Using ReflectionUtil.HasAttribute, check if the current property has an attribute of type EntityControlAttribute. If it does:
Use ReflectionUtil.GetAttributePropertyValueAsString to get the value of the ControlType property of the EntityControlAttribute on the current property. Store it in a string variable named controlType.
Repeat the step above but get the value of the Description property of the EntityControlAttribute. Store the result in a variable named description.
Add the name of the property and the attribute value to the memberListBox's items.
$"{p.Name} - {description} - {controlType}"Click on a type. Nothing should show up in the memberListBox. This is because none of the properties in the classes have the EntityControlAttribute on them.
Return to each story and verify its acceptance criteria. Preserve the submission format and destination stated in the activity; a reading, setup guide, lab, video demonstration, and oral final may require different evidence.
Describe editable properties with attributes Read attribute values with reusable reflection helpers Explore type and property metadata in the window