IEnumerable CreateNestedContext(EvaluatorProperty collectionProperty) { if(collectionProperty == null) { EvaluatorContext[] old = contexts; contexts = new EvaluatorContext[old.Length + 1]; Array.Copy(old, 0, contexts, 1, old.Length); return contexts[1].GetCollectionContexts(null); } EvaluatorContext[] parentContext = contexts; contexts = new EvaluatorContext[parentContext.Length - collectionProperty.UpDepth + collectionProperty.PropertyPathTokenized.Length]; Array.Copy(parentContext, collectionProperty.UpDepth, contexts, collectionProperty.PropertyPathTokenized.Length, contexts.Length - collectionProperty.PropertyPathTokenized.Length); int currentContextIndex = collectionProperty.PropertyPathTokenized.Length; int currentPathIndex = 0; while(currentContextIndex > 1) { EvaluatorContext currentContext = contexts[currentContextIndex]; string currentProperty = collectionProperty.PropertyPathTokenized[currentPathIndex]; currentContext = currentContext.GetNestedContext(currentProperty); if(currentContext == null) return null; --currentContextIndex; ++currentPathIndex; contexts[currentContextIndex] = currentContext; } return contexts[1].GetCollectionContexts(collectionProperty.PropertyPathTokenized[collectionProperty.PropertyPathTokenized.Length - 1]); }
public abstract object GetPropertyValue(object source, EvaluatorProperty propertyPath);
public override object GetPropertyValue(object source, EvaluatorProperty propertyPath) { object res = GetPropertyValue(source, propertyPath.PropertyPath, propertyPath.PropertyPathTokenized.Length > 1); if(res != noResult) return res; EvaluatorContext nestedContext = this.GetNestedContext(source, propertyPath.PropertyPathTokenized[0]); if(nestedContext == null) return null; return nestedContext.GetPropertyValue(propertyPath.SubProperty); }
public object GetPropertyValue(EvaluatorProperty propertyPath) { return Descriptor.GetPropertyValue(Source, propertyPath); }