Skip to content

Commit

Permalink
fix issue where edit changes would fail to apply due to an incompatib…
Browse files Browse the repository at this point in the history
…le cast on the wrong object
  • Loading branch information
hahn-kev committed Oct 9, 2024
1 parent cc0a769 commit a63c3ab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/SIL.Harmony/Changes/Change.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ public async ValueTask ApplyChange(IObjectBase entity, ChangeContext context)
{
if (this is CreateChange<T>)
return; // skip attempting to apply changes on CreateChange as it does not support apply changes
if (entity is T entityT) await ApplyChange(entityT, context);
if (entity.DbObject is T entityT)
{
await ApplyChange(entityT, context);
}
else
{
throw new NotSupportedException($"Type {entity.DbObject.GetType()} is not type {typeof(T)}");
}
}

[JsonIgnore]
public Type EntityType => typeof(T);
}
}

0 comments on commit a63c3ab

Please sign in to comment.