private void WalkIntoProperty(IPropertyWalkerVisitor <TResult, TWalkInfo> visitor, PropertyInfo property, TWalkInfo walkInfo) { var fieldsWithPropertyPrefix = new List <string>(); var propertyWalkInfoFields = walkInfo.Fields.Contains("*") ? new List <string> { "*" } : RemovePropertyPrefixFromFields(fieldsWithPropertyPrefix = GetFieldsWithPropertyPrefix(walkInfo.Fields, property.Name).ToList(), property.Name); visitor.Visit(property, BuildWalkInfoForProperty(walkInfo, propertyWalkInfoFields)); walkInfo.Fields = walkInfo.Fields.Except(fieldsWithPropertyPrefix, StringComparer.OrdinalIgnoreCase); }
public virtual TResult Accept(IPropertyWalkerVisitor <TResult, TWalkInfo> visitor, TWalkInfo walkInfo) { walkInfo.WalkedTypes.Add(walkInfo.Type); var fieldFirstParts = GetFirstPartsFromFields(walkInfo.Fields); var properties = GetProperties(walkInfo, fieldFirstParts); if (!walkInfo.Fields.Contains("*")) { walkInfo.Fields = walkInfo.Fields.Except(fieldFirstParts); } walkInfo.RelatedDataLevel--; foreach (var property in properties) { WalkIntoProperty(visitor, property, walkInfo); } return(visitor.Output(walkInfo)); }