private ModelConfigurationNode GotoIndexerOrEachElement([CanBeNull] ModelConfigurationNode child, [NotNull] Expression[] indexerArguments) { if (child == null) { return(null); } var indexerParameters = indexerArguments.Select(exp => ((ConstantExpression)exp).Value).ToArray(); // Try go by 'indexer' edge var newChild = child.GotoIndexer(indexerParameters, createPath); if (newChild != null) { return(newChild); } // If no child exists and create:false go by 'each' edge and create array alias for migration newChild = child.GotoEachArrayElement(create: false); if (newChild == null) { return(null); } var array = GetArrayMigrationAlias(child); if (array != null) { ArrayAliases.Add(new KeyValuePair <Expression, Expression>( Expression.Call(array, array.Type.GetProperty("Item", BindingFlags.Public | BindingFlags.Instance).GetGetMethod(), indexerArguments), Expression.Property(array.MakeEachCall(), "Value"))); } return(newChild.GotoMember(newChild.NodeType.GetProperty("Value", BindingFlags.Public | BindingFlags.Instance), create: false)); }
private ModelConfigurationNode GotoArrayIndexOrEachElement([CanBeNull] ModelConfigurationNode child, [NotNull] Expression index) { if (child == null) { return(null); } var newChild = child.GotoArrayElement(GetIndex(index), createPath); if (newChild != null) { return(newChild); } // If no child exists and create:false create array alias for migration and go by 'Each' edge var array = GetArrayMigrationAlias(child); if (array != null) { ArrayAliases.Add(new KeyValuePair <Expression, Expression>( Expression.ArrayIndex(array, index), array.MakeEachCall())); } return(child.GotoEachArrayElement(create: false)); }