4 ms·
I was able to code like next // merge update into immutable (each mutation gives new handle) private void MergeIntoImmutableThreadAffinedObject(Updates.ICase
by dlahoda 8y ago
I was able to code like next
// merge update into immutable (each mutation gives new handle)
private void MergeIntoImmutableThreadAffinedObject(Updates.ICase update)
{
switch (update)
{
case ICase<ImmutableTimeSeriesFilesDatabase> c:
_updater.Update(x => x.Set(RefCountedHandle, c.Value));
return;
case ICase<ImmutableObjectDatabase> m:
_updater.Update(x => x.Set(Configuration, m.Value));
return;
case ICase<ITimeSeriesFilterSort> f:
_updater.Update(x => x.Set(SearchFilterSort, f.Value));
return;
case ICase<IApplicationFilters> a:
_updater.Update(x => x.Set(ApplicationFilters, a.Value));
return;
default: throw new NotSupportedException();
}
}
}
- dlahoda 8y agointernal sealed class Updates : Union<Updates, ImmutableTimeSeriesFilesDatabase, ImmutableObjectDatabase, ITimeSeriesFilterSort, IApplicationFilters> { }