From 7c81f0230ebd136b5cb09634a0f0754343c40d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Lema=C3=B1czyk?= Date: Sun, 29 Nov 2015 13:28:18 +0100 Subject: [PATCH] Fix for issue #81 SqlException: Ambiguous column name 'XXX'. --- Source/EntityFramework.Extended/Batch/MySqlBatchRunner.cs | 6 +++--- .../EntityFramework.Extended/Batch/SqlServerBatchRunner.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/EntityFramework.Extended/Batch/MySqlBatchRunner.cs b/Source/EntityFramework.Extended/Batch/MySqlBatchRunner.cs index 7b76fd9..7fc94be 100644 --- a/Source/EntityFramework.Extended/Batch/MySqlBatchRunner.cs +++ b/Source/EntityFramework.Extended/Batch/MySqlBatchRunner.cs @@ -310,11 +310,11 @@ private int InternalUpdate(ObjectContext objectContext, EntityMap entit parameter.Value = value; updateCommand.Parameters.Add(parameter); - sqlBuilder.AppendFormat("{0} = @{1}", columnName, parameterName); + sqlBuilder.AppendFormat("j0.{0} = @{1}", columnName, parameterName); } else { - sqlBuilder.AppendFormat("{0} = NULL", columnName); + sqlBuilder.AppendFormat("j0.{0} = NULL", columnName); } } else @@ -360,7 +360,7 @@ private int InternalUpdate(ObjectContext objectContext, EntityMap entit value = value.Replace(objectParameter.Name, parameterName); } - sqlBuilder.AppendFormat("{0} = {1}", columnName, value); + sqlBuilder.AppendFormat("j0.{0} = {1}", columnName, value); } wroteSet = true; } diff --git a/Source/EntityFramework.Extended/Batch/SqlServerBatchRunner.cs b/Source/EntityFramework.Extended/Batch/SqlServerBatchRunner.cs index 8f2fbb0..bfcdab3 100644 --- a/Source/EntityFramework.Extended/Batch/SqlServerBatchRunner.cs +++ b/Source/EntityFramework.Extended/Batch/SqlServerBatchRunner.cs @@ -291,11 +291,11 @@ private int InternalUpdate(ObjectContext objectContext, EntityMap entit parameter.Value = value; updateCommand.Parameters.Add(parameter); - sqlBuilder.AppendFormat("[{0}] = @{1}", columnName, parameterName); + sqlBuilder.AppendFormat("j0.[{0}] = @{1}", columnName, parameterName); } else { - sqlBuilder.AppendFormat("[{0}] = NULL", columnName); + sqlBuilder.AppendFormat("j0.[{0}] = NULL", columnName); } } else @@ -341,7 +341,7 @@ private int InternalUpdate(ObjectContext objectContext, EntityMap entit value = value.Replace(objectParameter.Name, parameterName); } - sqlBuilder.AppendFormat("[{0}] = {1}", columnName, value); + sqlBuilder.AppendFormat("j0.[{0}] = {1}", columnName, value); } wroteSet = true; }