protected override Expression VisitMemberInit(MemberInitExpression node) { for (var bindingIndex = 0; bindingIndex < node.Bindings.Count; bindingIndex++) { var initExpressionBinding = node.Bindings[bindingIndex]; if (initExpressionBinding.BindingType != MemberBindingType.Assignment) { throw new NotSupportedException(); } var memberAssignment = (MemberAssignment)initExpressionBinding; if (bindingIndex != 0) { _statementBuilder.Append(","); _statementBuilder.AppendLine(); } var relationalPropertyAnnotations = _entityType.FindProperty(memberAssignment.Member.Name).Relational(); var columnName = relationalPropertyAnnotations.ColumnName; _currentAssignmentColumnType = relationalPropertyAnnotations.ColumnType; _statementBuilder.Append(" "); _statementBuilder.DelimitIdentifier(columnName); _statementBuilder.Append(" = "); Visit(memberAssignment.Expression); } return(node); }
protected override Expression VisitMember(MemberExpression node) { var lambdaExpression = (LambdaExpression)_conflictIndexColumnExpression; var parameterExpression = (ParameterExpression)node.Expression; if (lambdaExpression.Parameters[0].Equals(parameterExpression)) { _statementBuilder.DelimitIdentifier(_entityType.FindProperty(node.Member.Name).Relational().ColumnName); return(node); } throw new NotSupportedException(); }