Skip to content

Commit 5f9a27c

Browse files
authored
Added new operator .AsyncDisposeMany(), equivalent to .DisposeMany(), but with support for IAsyncDisposable. (#1011)
1 parent 29424ad commit 5f9a27c

File tree

7 files changed

+922
-6
lines changed

7 files changed

+922
-6
lines changed

src/Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
<ItemGroup>
6363
<PackageReference Include="Nerdbank.GitVersioning" Version="3.7.112" PrivateAssets="all" />
6464
</ItemGroup>
65+
<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">
66+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.5" />
67+
</ItemGroup>
6568
<ItemGroup Condition="!$(IsTestProject) AND !$(IsBenchmarkProject)">
6669
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
6770
<PackageReference Include="Roslynator.Analyzers" Version="4.13.1" PrivateAssets="All" />

src/Directory.build.targets

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,35 @@
1515
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
1616
</PropertyGroup>
1717

18+
<PropertyGroup Condition="($(TargetFramework) == 'netstandard2.0') OR ($(TargetFramework) == 'netstandard2.1')">
19+
<DefineConstants>$(DefineConstants);SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
20+
</PropertyGroup>
21+
1822
<PropertyGroup Condition="$(TargetFramework.StartsWith('netcoreapp'))">
19-
<DefineConstants>$(DefineConstants);NETCOREAPP;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
23+
<DefineConstants>$(DefineConstants);NETCOREAPP;P_LINQ;SUPPORTS_BINDINGLIST;SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
24+
</PropertyGroup>
25+
26+
<PropertyGroup Condition="($(TargetFramework) == 'netcoreapp3.0') OR ($(TargetFramework) == 'netcoreapp3.1')">
27+
<DefineConstants>$(DefineConstants);SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
2028
</PropertyGroup>
2129

2230
<PropertyGroup Condition="$(TargetFramework.StartsWith('net5'))">
23-
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
31+
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST;SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
2432
</PropertyGroup>
2533

2634
<PropertyGroup Condition="$(TargetFramework.StartsWith('net6'))">
27-
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
35+
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST;SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
2836
</PropertyGroup>
2937

3038
<PropertyGroup Condition="$(TargetFramework.StartsWith('net7'))">
31-
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
39+
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST;SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
3240
</PropertyGroup>
3341

3442
<PropertyGroup Condition="$(TargetFramework.StartsWith('net8'))">
35-
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
43+
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST;SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
3644
</PropertyGroup>
45+
3746
<PropertyGroup Condition="$(TargetFramework.StartsWith('net9'))">
38-
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST</DefineConstants>
47+
<DefineConstants>$(DefineConstants);NETSTANDARD;PORTABLE;P_LINQ;SUPPORTS_BINDINGLIST;SUPPORTS_ASYNC_DISPOSABLE</DefineConstants>
3948
</PropertyGroup>
4049
</Project>

src/DynamicData.Tests/API/ApiApprovalTests.DynamicDataTests.DotNet9_0.verified.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,9 @@ namespace DynamicData
11371137
public static DynamicData.IObservableCache<TObject, TKey> AsObservableCache<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, bool applyLocking = true)
11381138
where TObject : notnull
11391139
where TKey : notnull { }
1140+
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> AsyncDisposeMany<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.Action<System.IObservable<System.Reactive.Unit>> disposalsCompletedAccessor)
1141+
where TObject : notnull
1142+
where TKey : notnull { }
11401143
public static System.IObservable<DynamicData.IChangeSet<TObject, TKey>> AutoRefresh<TObject, TKey>(this System.IObservable<DynamicData.IChangeSet<TObject, TKey>> source, System.TimeSpan? changeSetBuffer = default, System.TimeSpan? propertyChangeThrottle = default, System.Reactive.Concurrency.IScheduler? scheduler = null)
11411144
where TObject : System.ComponentModel.INotifyPropertyChanged
11421145
where TKey : notnull { }

0 commit comments

Comments
 (0)