diff --git a/backend/Origam.DA.Service/AbstractSqlDataService.cs b/backend/Origam.DA.Service/AbstractSqlDataService.cs index 276e54c28a..2f7ac8c05b 100644 --- a/backend/Origam.DA.Service/AbstractSqlDataService.cs +++ b/backend/Origam.DA.Service/AbstractSqlDataService.cs @@ -651,14 +651,15 @@ var stringWriter query.SortSetId, query.DefaultSetId); } - if(newTransaction) - { + var errorString = ComposeConcurrencyErrorMessage(userProfile, + dataset, transactionId, currentEntityName, lastTableName, + ex); + if (newTransaction) + { ResourceMonitor.Rollback(transactionId); transactionId = null; } - var errorString = ComposeConcurrencyErrorMessage(userProfile, - dataset, transactionId, currentEntityName, lastTableName, - ex); + // log before throw (because there are some place(s) // where the exception isn't caught if(concurrencyLog.IsDebugEnabled) @@ -799,8 +800,8 @@ IDataEntityColumn describingField { continue; } - var storedValue = ""; - var myValue = ""; + string storedValue = null; + string myValue = null; if(!storedRow.IsNull(column.ColumnName)) { storedValue = storedRow[column.ColumnName] @@ -811,7 +812,8 @@ IDataEntityColumn describingField myValue = row[column, DataRowVersion.Original] .ToString(); } - if(storedValue.Equals(myValue)) + if(storedValue != null && storedValue.Equals(myValue) + || (storedValue == null && myValue == null)) { continue; } @@ -843,9 +845,9 @@ var lookupId + "- " + column.Caption + ": " - + myValue + + (myValue ?? "null") + " > " - + storedValue; + + (storedValue ?? "null"); } } while(row.Table.ParentRelations.Count > 0) diff --git a/backend/Origam.DA.Service/Generators/DatasetGenerator.cs b/backend/Origam.DA.Service/Generators/DatasetGenerator.cs index 7ab55f97c9..9fab9b4758 100644 --- a/backend/Origam.DA.Service/Generators/DatasetGenerator.cs +++ b/backend/Origam.DA.Service/Generators/DatasetGenerator.cs @@ -372,10 +372,14 @@ public DataSet CreateDataSet(DataStructure ds, bool includeCalculatedColumns, Da tableColumn.ExtendedProperties.Add(Const.OrigamDataType, finalDataType); tableColumn.ExtendedProperties.Add(Const.FieldId, finalColumn.Id); switch(column.Field) - { + { + // mark column as a database field if the entity column + // is of type FieldMappingItem and the datastructure column + // doesn't have 'UseLookupValue' set (read-only datastructure lookups + // aren't saveable so they aren't actually database fields) case FieldMappingItem _: tableColumn.ExtendedProperties.Add( - Const.IsDatabaseField, true); + Const.IsDatabaseField, !column.UseLookupValue); break; case DetachedField detachedField when detachedField.DataType == OrigamDataType.Array: