RoomSharp.Reactive
0.4.7
dotnet add package RoomSharp.Reactive --version 0.4.7
NuGet\Install-Package RoomSharp.Reactive -Version 0.4.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RoomSharp.Reactive" Version="0.4.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RoomSharp.Reactive" Version="0.4.7" />
<PackageReference Include="RoomSharp.Reactive" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RoomSharp.Reactive --version 0.4.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RoomSharp.Reactive, 0.4.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RoomSharp.Reactive@0.4.7
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RoomSharp.Reactive&version=0.4.7
#tool nuget:?package=RoomSharp.Reactive&version=0.4.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RoomSharp.Reactive
Lightweight reactive operators, computed views, query caching, and UI collection binding for RoomSharp. Includes optional Rx.NET adapters.
Installation
dotnet add package RoomSharp.Reactive
Observe + debounce
using RoomSharp.Reactive;
var todos = db.GetTableIdOrThrow("todos");
// Default debounce uses ReactiveDefaults.DefaultDebounceInterval (150ms)
var query = db.ObserveReactive(
ct => new ValueTask<IReadOnlyList<Todo>>(db.TodoDao.GetAllAsync()),
new ReactiveQueryOptions
{
DebounceInterval = TimeSpan.FromMilliseconds(200)
},
todos);
using var subscription = query.Subscribe(
list => Render(list),
error => Log(error));
QueryCache (single-flight + TTL)
using RoomSharp.Reactive;
var cache = new QueryCache(db);
var key = db.BuildCacheKey<IReadOnlyList<Todo>>("select * from todos", parameters: null);
var cached = db.ObserveCached(
cache,
key,
ct => new ValueTask<IReadOnlyList<Todo>>(db.TodoDao.GetAllAsync()),
new QueryCacheEntryOptions
{
Ttl = TimeSpan.FromSeconds(10),
TableIds = new[] { db.GetTableIdOrThrow("todos") }
},
options: null,
db.GetTableIdOrThrow("todos"));
using var sub = cached.Subscribe(
list => Render(list),
error => Log(error));
ComputedView (derived reactive value)
using RoomSharp.Reactive;
var todosQuery = db.ObserveReactive(
ct => new ValueTask<IReadOnlyList<Todo>>(db.TodoDao.GetAllAsync()),
db.GetTableIdOrThrow("todos"));
var stats = ComputedView.Combine(
todosQuery,
todos => new TodoStats(todos.Count),
new ComputedViewOptions
{
DebounceInterval = TimeSpan.FromMilliseconds(200)
});
using var sub = stats.Subscribe(
value => UpdateStats(value),
error => Log(error));
ObservableCollection binding (WPF/WinUI)
using RoomSharp.Reactive;
using System.Collections.ObjectModel;
using System.Threading;
var collection = new ObservableCollection<Todo>();
using var sub = query
.AsObservable()
.BindToObservableCollection(
collection,
SynchronizationContext.Current,
keySelector: t => t.Id,
mergeExisting: (existing, incoming) =>
{
existing.Title = incoming.Title;
existing.IsDone = incoming.IsDone;
});
Lightweight operators (no System.Reactive dependency)
using RoomSharp.Reactive;
var stream = query
.AsObservable()
.DistinctUntilChanged()
.Throttle(TimeSpan.FromMilliseconds(150))
.Buffer(TimeSpan.FromMilliseconds(250));
Rx.NET integration (optional)
using RoomSharp.Reactive.Rx;
var observable = query.ToObservable();
observable
.Throttle(TimeSpan.FromMilliseconds(300))
.DistinctUntilChanged()
.Subscribe(list => Render(list));
Requirements
- RoomSharp 0.4.3+
- System.Reactive 6.0+ (only if you use the Rx integration)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- RoomSharp (>= 0.4.7)
- System.Reactive (>= 6.1.0)
-
net8.0
- RoomSharp (>= 0.4.7)
- System.Reactive (>= 6.1.0)
-
net9.0
- RoomSharp (>= 0.4.7)
- System.Reactive (>= 6.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RoomSharp.Reactive:
| Package | Downloads |
|---|---|
|
RoomSharp.Reactive.WinForms
WinForms UI binding helpers for RoomSharp.Reactive (BindingList, BindingSource, DataGridView). |
GitHub repositories
This package is not used by any popular GitHub repositories.