using DynamicData;
namespace StabilityMatrix.Core.Extensions;
public static class DynamicDataExtensions
{
///
/// Loads the cache with the specified items in an optimised manner i.e. calculates the differences between the old and new items
/// in the list and amends only the differences.
///
/// The type of the object.
/// The type of the key.
/// The source.
/// The items to add, update or delete.
/// source.
public static void EditDiff(
this ISourceCache source,
IEnumerable allItems
)
where TObject : IEquatable
where TKey : notnull
{
if (source is null)
{
throw new ArgumentNullException(nameof(source));
}
if (allItems is null)
{
throw new ArgumentNullException(nameof(allItems));
}
source.EditDiff(allItems, (x, y) => x.Equals(y));
}
}