protected void Initialize(ICustomAttributeProvider member) { ConstructorParameterAttribute ctorAttr = ReflectionUtils.GetAttribute <ConstructorParameterAttribute>(member, false); if (ctorAttr != null) { if (ctorAttr.Position >= 0) { position = ctorAttr.Position; } else if (!string.IsNullOrEmpty(ctorAttr.Name)) { this.constructorParameterName = ctorAttr.Name; } else { this.constructorParameterName = this.Name; } } }
public override void Process(IMetaData metaData, ICustomAttributeProvider attributeProvider, ISerializerSettings config) { if (metaData is IPropertyData) { IPropertyData property = (IPropertyData)metaData; ConstructorParameterAttribute ctorAttr = ReflectionUtils.GetAttribute <ConstructorParameterAttribute>(attributeProvider, false); if (ctorAttr != null) { if (!string.IsNullOrEmpty(ctorAttr.Name)) { property.ConstructorParameterName = ctorAttr.Name; } else { property.ConstructorParameterName = property.Name; } property.Ignored = false; } } }