Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Empty concurrency exception #1689

Merged
merged 1 commit into from Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 12 additions & 10 deletions backend/Origam.DA.Service/AbstractSqlDataService.cs
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand All @@ -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;
}
Expand Down Expand Up @@ -843,9 +845,9 @@ var lookupId
+ "- "
+ column.Caption
+ ": "
+ myValue
+ (myValue ?? "null")
+ " > "
+ storedValue;
+ (storedValue ?? "null");
}
}
while(row.Table.ParentRelations.Count > 0)
Expand Down
8 changes: 6 additions & 2 deletions backend/Origam.DA.Service/Generators/DatasetGenerator.cs
Expand Up @@ -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:
Expand Down