Skip to content

Commit

Permalink
Feature: TransformMany Async (#824)
Browse files Browse the repository at this point in the history
Implements `TransformManyAsync` and `TransformManySafeAsync` for #461.
Creates a new operator implementation that is based on the implementation of `MergeManyChangeSets` but allows the child selector to be Async, allows for an optional error handler, and does "best effort" to try to minimize the number of changesets.
  • Loading branch information
dwcullop committed Jan 26, 2024
1 parent 5148d14 commit dac44e1
Show file tree
Hide file tree
Showing 11 changed files with 1,052 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,70 @@ namespace DynamicData
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManyAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, System.Threading.Tasks.Task<DynamicData.IObservableCache<TDestination, TDestinationKey>>> manySelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManyAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, TSourceKey, System.Threading.Tasks.Task<DynamicData.IObservableCache<TDestination, TDestinationKey>>> manySelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManyAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<TDestination>>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManyAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, TSourceKey, System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<TDestination>>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManyAsync<TDestination, TDestinationKey, TSource, TSourceKey, TCollection>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, System.Threading.Tasks.Task<TCollection>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull
where TCollection : System.Collections.Specialized.INotifyCollectionChanged, System.Collections.Generic.IEnumerable<TDestination> { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManyAsync<TDestination, TDestinationKey, TSource, TSourceKey, TCollection>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, TSourceKey, System.Threading.Tasks.Task<TCollection>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull
where TCollection : System.Collections.Specialized.INotifyCollectionChanged, System.Collections.Generic.IEnumerable<TDestination> { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManySafeAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, System.Threading.Tasks.Task<DynamicData.IObservableCache<TDestination, TDestinationKey>>> manySelector, System.Action<DynamicData.Kernel.Error<TSource, TSourceKey>> errorHandler, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManySafeAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, TSourceKey, System.Threading.Tasks.Task<DynamicData.IObservableCache<TDestination, TDestinationKey>>> manySelector, System.Action<DynamicData.Kernel.Error<TSource, TSourceKey>> errorHandler, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManySafeAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<TDestination>>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Action<DynamicData.Kernel.Error<TSource, TSourceKey>> errorHandler, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManySafeAsync<TDestination, TDestinationKey, TSource, TSourceKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, TSourceKey, System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<TDestination>>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Action<DynamicData.Kernel.Error<TSource, TSourceKey>> errorHandler, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManySafeAsync<TDestination, TDestinationKey, TSource, TSourceKey, TCollection>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, System.Threading.Tasks.Task<TCollection>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Action<DynamicData.Kernel.Error<TSource, TSourceKey>> errorHandler, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull
where TCollection : System.Collections.Specialized.INotifyCollectionChanged, System.Collections.Generic.IEnumerable<TDestination> { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TDestinationKey>> TransformManySafeAsync<TDestination, TDestinationKey, TSource, TSourceKey, TCollection>(this System.IObservable<DynamicData.IChangeSet<TSource, TSourceKey>> source, System.Func<TSource, TSourceKey, System.Threading.Tasks.Task<TCollection>> manySelector, System.Func<TDestination, TDestinationKey> keySelector, System.Action<DynamicData.Kernel.Error<TSource, TSourceKey>> errorHandler, System.Collections.Generic.IEqualityComparer<TDestination>? equalityComparer = null, System.Collections.Generic.IComparer<TDestination>? comparer = null)
where TDestination : notnull
where TDestinationKey : notnull
where TSource : notnull
where TSourceKey : notnull
where TCollection : System.Collections.Specialized.INotifyCollectionChanged, System.Collections.Generic.IEnumerable<TDestination> { }
public static System.IObservable<DynamicData.IChangeSet<TDestination, TKey>> TransformSafe<TDestination, TSource, TKey>(this System.IObservable<DynamicData.IChangeSet<TSource, TKey>> source, System.Func<TSource, TDestination> transformFactory, System.Action<DynamicData.Kernel.Error<TSource, TKey>> errorHandler, System.IObservable<System.Reactive.Unit> forceTransform)
where TDestination : notnull
where TSource : notnull
Expand Down

0 comments on commit dac44e1

Please sign in to comment.