private void VisitProperty(PropertyInfo property, RegisterElement element) { if (element.property == null) { element.property = new List <PropertyElement>(); } var attribute = property.GetDependencyInjectionOnProperty(); var defaultValueAttribute = property.GetDefaultValueOnProperty(); var e = new PropertyElement(); e.name = property.Name; if (attribute != null && attribute.DefaultValue != null) { e.Item = new ValueElement() { value = attribute.DefaultValue != null?attribute.DefaultValue.ToString() : null, type = attribute.DefaultValue.GetType().ToString() }; element.property.Add(e); } else if (attribute != null) { e.name = property.Name; e.Item = new DependencyElement() { typeOfContract = property.PropertyType.AssemblyQualifiedName, key = attribute.Key != null?attribute.Key.ToString() : null }; element.property.Add(e); } else if (defaultValueAttribute != null && defaultValueAttribute.Value != null) { e.Item = new ValueElement() { value = defaultValueAttribute.Value != null?defaultValueAttribute.Value.ToString() : null, type = defaultValueAttribute.Value.GetType().ToString() }; element.property.Add(e); } }
private void VisitProperty(PropertyInfo property, RegisterElement element) { if (element.property == null) element.property = new List<PropertyElement>(); var attribute = property.GetDependencyInjectionOnProperty(); var defaultValueAttribute = property.GetDefaultValueOnProperty(); var e = new PropertyElement(); e.name = property.Name; if (attribute != null && attribute.DefaultValue != null) { e.Item = new ValueElement() { value = attribute.DefaultValue != null ? attribute.DefaultValue.ToString() : null, type = attribute.DefaultValue.GetType().ToString() }; element.property.Add(e); } else if( attribute != null ) { e.name = property.Name; e.Item = new DependencyElement() { typeOfContract = property.PropertyType.AssemblyQualifiedName, key = attribute.Key != null ? attribute.Key.ToString() : null }; element.property.Add(e); } else if (defaultValueAttribute != null && defaultValueAttribute.Value != null ) { e.Item = new ValueElement() { value = defaultValueAttribute.Value != null ? defaultValueAttribute.Value.ToString() : null, type = defaultValueAttribute.Value.GetType().ToString() }; element.property.Add(e); } }