public override NLinq.Expressions.SelectOrGroupClause Visit(NLinq.Expressions.SelectClause expression) { AnonymousParameterList parameters = new AnonymousParameterList(); foreach (var attribute in target.Attributes) { if (!attribute.Value.IsId) continue; parameters.Add(new AnonymousParameter(attribute.Key, new MemberExpression(new Identifier(attribute.Key), targetIdentifier))); } parameters.Add(new AnonymousParameter("Entity", expression.Expression)); return updater.Update(expression, new AnonymousNew(null, parameters)); }
public NLinq.Expressions.Expression Visit(System.Linq.Expressions.NewExpression expression) { AnonymousParameterList @params = new AnonymousParameterList(); for (int i = 0; i < expression.Arguments.Count; i++) { System.Linq.Expressions.Expression arg = expression.Arguments[i]; string name = expression.Members[i].Name; @params.Add(new AnonymousParameter(new Identifier(name), Visit(arg))); } return new AnonymousNew(null, @params); }