KhepriDotNet 1.0.1
dotnet add package KhepriDotNet --version 1.0.1
NuGet\Install-Package KhepriDotNet -Version 1.0.1
<PackageReference Include="KhepriDotNet" Version="1.0.1" />
paket add KhepriDotNet --version 1.0.1
#r "nuget: KhepriDotNet, 1.0.1"
// Install KhepriDotNet as a Cake Addin #addin nuget:?package=KhepriDotNet&version=1.0.1 // Install KhepriDotNet as a Cake Tool #tool nuget:?package=KhepriDotNet&version=1.0.1
KhepriDotNet
KhepriDotNet is a state-of-the-art .NET library tailored for efficient and flexible state management. It leverages Functional Reactive Programming (FRP) principles to facilitate responsive and maintainable application states.
Problem Definition
Managing state in applications can be challenging, especially in environments where state changes frequently and unpredictably. Traditional methods often lead to complicated and error-prone code.
Solution: Reactive Functional Programming
KhepriDotNet solves these challenges by combining the principles of FRP. This approach allows for more predictable state management, making your code more maintainable and responsive.
Features
- Reactive State Management with Observables
- Strong Emphasis on Immutability and Validation
- Easy Integration with .NET Dependency Injection
Getting Started
To get started with KhepriDotNet, install the package via NuGet:
Install-Package KhepriDotNet
Implementing a Store
To create a store, define a class inheriting from Store<T>
and use the [Action]
attribute to mark methods modifying the state.
public class StudentRecordStore : Store<StudentRecord>
{
[Action]
public StudentRecord UpdateName(string name)
{
return CurrentState with { Name = name };
}
[Action]
public StudentRecord UpdateAge(int age)
{
// Update age logic
}
protected override void Validate(StudentRecord state)
{
// Implement validation logic here
}
}
Custom Validation for State Consistency
In KhepriDotNet, overriding the Validate
method is crucial for maintaining state consistency. This custom validation process ensures that only valid data manipulates the state, preventing inconsistencies and potential errors in your application. It acts as a safeguard, allowing you to define rules and constraints that the state must adhere to.
protected override void Validate(StudentRecord state)
{
// Implement validation logic here
}
By performing these checks before any state update, KhepriDotNet helps in maintaining a robust and reliable application, where state transitions are safe and predictable.
Registering a Store
Register your store with the .NET service collection for dependency injection:
services.AddStore<StudentRecordStore, StudentRecord>();
Subscribing to a Store
Subscribe to state changes in the store:
var store = serviceProvider.GetRequiredService<StudentRecordStore>();
store.Subscribe(state => {
// React to state updates
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Castle.Windsor (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- System.Reactive (>= 6.0.0)
- System.Reactive.Linq (>= 6.0.0)
-
net7.0
- Castle.Windsor (>= 6.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- System.Reactive (>= 6.0.0)
- System.Reactive.Linq (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.