From d8aad718d50643f0e4c3f9281055c68f22eba894 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 17 Jul 2013 11:28:46 +1000 Subject: [PATCH] Fixed broken unit test --- src/Umbraco.Core/Persistence/PetaPocoExtensions.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs b/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs index 6faf4d637a..51ae2638b0 100644 --- a/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs +++ b/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs @@ -74,7 +74,11 @@ namespace Umbraco.Core.Persistence //get all columns but not the primary key if it is auto-incremental var cols = string.Join(", ", ( from c in pd.Columns - where c.Value.ResultColumn == false + where + //don't return ResultColumns + !c.Value.ResultColumn + //if the table is auto-incremental, don't return the primary key + && (pd.TableInfo.AutoIncrement && c.Key != pd.TableInfo.PrimaryKey) select tableName + "." + db.EscapeSqlIdentifier(c.Key)) .ToArray()); @@ -87,10 +91,10 @@ namespace Umbraco.Core.Persistence var values = new List(); foreach (var i in pd.Columns) { - //if (pd.TableInfo.AutoIncrement && i.Key == pd.TableInfo.PrimaryKey) - //{ - // continue; - //} + if (pd.TableInfo.AutoIncrement && i.Key == pd.TableInfo.PrimaryKey) + { + continue; + } values.Add(string.Format("{0}{1}", "@", index++)); db.AddParam(cmd, i.Value.GetValue(poco), "@"); }