protected virtual void TraverseProperties <TContext>(IObjectDescriptor value, IObjectGraphVisitor <TContext> visitor, TContext context, Stack <ObjectPathSegment> path) { visitor.VisitMappingStart(value, typeof(string), typeof(object), context); var source = value.NonNullValue(); foreach (var propertyDescriptor in typeDescriptor.GetProperties(value.Type, source)) { var propertyValue = propertyDescriptor.Read(source); if (visitor.EnterMapping(propertyDescriptor, propertyValue, context)) { Traverse(propertyDescriptor.Name, new ObjectDescriptor(propertyDescriptor.Name, typeof(string), typeof(string)), visitor, context, path); Traverse(propertyDescriptor.Name, propertyValue, visitor, context, path); } } visitor.VisitMappingEnd(value, context); }
public IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { if (type != typeof(DynamicXml)) { return(_baseTypeInspector.GetProperties(type, container)); } var properties = new List <IPropertyDescriptor>(); var dynamicXml = container as DynamicXml; var order = 0; foreach (var memberName in dynamicXml.GetDynamicMemberNames()) { var property = GetProperty(dynamicXml, memberName, true, order++); if (property != null) { properties.Add(property); } } return(properties); }
protected virtual void TraverseProperties <TContext>(IObjectDescriptor value, IObjectGraphVisitor visitor, int currentDepth, IObjectGraphVisitorContext context) { var v = (IObjectGraphVisitor <TContext>)visitor; var c = (TContext)context; v.VisitMappingStart(value, typeof(string), typeof(object), c); foreach (var propertyDescriptor in _typeDescriptor.GetProperties(value.Type, value.Value)) { var propertyValue = propertyDescriptor.Read(value.Value); if (v.EnterMapping(propertyDescriptor, propertyValue, c)) { Traverse(new BetterObjectDescriptor(propertyDescriptor.Name, typeof(string), typeof(string)), v, currentDepth, c); Traverse(propertyValue, v, currentDepth, c); } } v.VisitMappingEnd(value, c); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(_innerTypeDescriptor.GetProperties(type, container).Select((p => { if (p.Name == "unique-items") { } var customAttribute = p.GetCustomAttribute <JsonPropertyAttribute>(); if (customAttribute == null) { return p; } return new PropertyDescriptor(p) { Name = customAttribute.PropertyName, }; }))); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(innerTypeDescriptor.GetProperties(type, container) .Where(p => p.GetCustomAttribute <YamlIgnoreAttribute>() == null) .Select(p => { var descriptor = new PropertyDescriptor(p); #pragma warning disable 0618 // 'YamlDotNet.Serialization.YamlAliasAttribute' is obsolete: 'Please use YamlMember instead' var alias = p.GetCustomAttribute <YamlAliasAttribute>(); if (alias != null) { descriptor.Name = alias.Alias; } #pragma warning restore 0618 // 'YamlDotNet.Serialization.YamlAliasAttribute' is obsolete: 'Please use YamlMember instead' var member = p.GetCustomAttribute <YamlMemberAttribute>(); if (member != null) { if (member.SerializeAs != null) { descriptor.TypeOverride = member.SerializeAs; } descriptor.Order = member.Order; descriptor.ScalarStyle = member.ScalarStyle; if (member.Alias != null) { if (alias != null) { throw new InvalidOperationException("Mixing YamlAlias(...) with YamlMember(Alias = ...) is an error. The YamlAlias attribute is obsolete and should be removed."); } descriptor.Name = member.Alias; } } return (IPropertyDescriptor)descriptor; }) .OrderBy(p => p.Order)); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { var props = _innerTypeInspector.GetProperties(type, container).ToList(); //order you want things comming out in (first) foreach (var propName in new [] { "Identifier", "Body", "Text" }) { var i = props.FirstOrDefault(p => p.Name == propName); if (i != null) { yield return(i); props.Remove(i); } } //then everything else foreach (var remaining in props) { yield return(remaining); } }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(from p in _innerTypeDescriptor.GetProperties(type, container) where p.CanWrite select p); }
public IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(TypeDescriptor.GetProperties(type, container)); }
public IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { var pds = _inner.GetProperties(type, container); return(pds.Select(pd => TrimPropertySuffix(pd, type)).ToList()); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(_typeInspector.GetProperties(type, container).Where(p => !_ignoredProperties.Contains(p.Name))); }
/// <inheritdoc/> public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(innerTypeDescriptor .GetProperties(type, container) .Select(descriptor => new CommentsPropertyDescriptor(descriptor))); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(_typeInspector.GetProperties(type, container).Where(p => p.Name != "extensions" && p.Name != "operation-id")); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(typeInspector.GetProperties(type, container) .Select(ConvertPropertyDescriptor) .Where(p => !(p is null))); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(innerTypeDescriptor.GetProperties(type, container).Where( p => !string.Equals(p.Name, "IsChanged", StringComparison.InvariantCultureIgnoreCase))); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(_innerTypeDescriptor.GetProperties(type, container) .Where(p => !p.Name.ContainsNoCase("password"))); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object?container) { return(cache.GetOrAdd(type, t => innerTypeDescriptor.GetProperties(t, container).ToList())); }
public override IEnumerable<IPropertyDescriptor> GetProperties(Type type, object container) { return innerTypeDescriptor.GetProperties(type, container) .Select(p => (IPropertyDescriptor)new PropertyDescriptor(p) { Name = namingConvention.Apply(p.Name) }); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(innerTypeInspector.GetProperties(type, container).OrderBy(x => x.Name)); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(_innerTypeDescriptor.GetProperties(type, container) .Where(p => p.CanWrite)); }
public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) { return(_innerInspector .GetProperties(type, container) .Select(p => new ExceptionPropertyWrappedDescriptor(p))); }