Jinaga.UnitTest
1.0.0
dotnet add package Jinaga.UnitTest --version 1.0.0
NuGet\Install-Package Jinaga.UnitTest -Version 1.0.0
<PackageReference Include="Jinaga.UnitTest" Version="1.0.0" />
paket add Jinaga.UnitTest --version 1.0.0
#r "nuget: Jinaga.UnitTest, 1.0.0"
// Install Jinaga.UnitTest as a Cake Addin #addin nuget:?package=Jinaga.UnitTest&version=1.0.0 // Install Jinaga.UnitTest as a Cake Tool #tool nuget:?package=Jinaga.UnitTest&version=1.0.0
Jinaga.NET
Resilient, reliable data transfer for .NET.
What it Does
In Jinaga, you define a data model in terms of immutable facts. A fact represents an entity, a change to an entity, or a decision that a user or service has made.
In Jinaga.NET, facts are C# record
s.:
[FactType("Corporate.Company")]
record Company(string identifier) {}
[FactType("Corporate.Employee")]
record Employee(Company company, int employeeNumber) {}
When a user or service makes a decision, you will add a fact to the system. This will store it in the local database. It will also update the local UI. And it will publish it so that others can learn about the decision.
var contoso = await j.Fact(new Company("Contoso"));
var jane = await j.Fact(new Employee(contoso, 1));
var bob = await j.Fact(new Employee(contoso, 2));
To query facts, write a specification. Start at a know fact and find all related facts that match that specification.
var employeesOfCompany = Given<Company>.Match((company, facts) =>
from employee in facts.OfType<Employee>()
where employee.company == company
select employee
);
var contosoEmployees = await j.Query(contoso, employeesOfCompany);
A query returns results at a point in time. If you want to keep a user interface up-to-date, you will need to set up an event-based watch.
var observer = j.Watch(contoso, employeesOfCompany, employee =>
{
var component = AddEmployeeComponent(employee);
return () =>
{
RemoveEmployeeComponent(component);
};
});
Finally, if you want to be notified in real time of new information, just subscribe.
var subscription = j.Subscribe(contoso, employeesOfCompany);
The client will open a persistent connection with the server. The server will notify the client the moment a new employee is hired. Because the client already set up a watch, the new employee will appear on the UI.
Running a Replicator
A Jinaga front end connects to a device called a Replicator. The Jinaga Replicator is a single machine in a network. It stores and shares facts. To get started, create a Replicator of your very own using Docker.
docker pull jinaga/jinaga-replicator
docker create --name my-replicator -p8080:8080 jinaga/jinaga-replicator
docker start my-replicator
This creates and starts a new container called my-replicator
.
The container is listening at port 8080 for commands.
Configure Jinaga to use the replicator:
var j = JinagaClient.Create(options =>
{
options.HttpEndpoint = new Uri("http://localhost:8080/jinaga");
});
Roadmap
Jinaga.NET is co-evolving with Jinaga.JS. Each of these projects has a front end and a back end. Either front end is intended to work with either back end. And the back ends are intended to interconnect to form a decision substrate.
APIs
The primary APIs for Jinaga are:
j.Fact
- Add and publish a factj.Query
- Project the facts matching a specificationj.Watch
- Continually update a projectionj.Subscribe
- Receive continuous updates from peers
The Subscribe
API is not fully implemented in Jinaga.JS, and not implemented yet in Jinaga.NET.
The JS version uses polling rather than the intended mechanism of Web Sockets or HTTP/2 Server Push.
Storage
Jinaga.NET currently has only memory storage, which is packaged with the core library. The next storage solutions to implement are SQLite to support Xamarin mobile apps and PostgreSQL to support Docker deployment. After that, the MS SQL Server implementation will support enterprise solutions that need to keep the journal transactionally consistent with the projection.
Rules
Authorization rules -- which limit the users who can create facts -- are implemented in Jinaga.JS, but not yet in Jinaga.NET. Distribution rules -- which limit the specifications that a user can query -- are not yet implemented in either.
Release
This repository uses Nerdbank.GitVersioning to manage version numbers.
To release a new version of the Jinaga.NET library, create a new tag in the format 1.2.3
.
Then create a new release based on that tag.
The release will be published to NuGet.
To accomplish this from the command line, use a combination of git
and gh
commands.
$VERSION = "1.2.3"
git checkout main
git pull
git tag $VERSION
git push --tags
gh release create $VERSION --generate-notes --verify-tag
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 was computed. 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. |
-
net6.0
- Jinaga (>= 1.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.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 110 | 7/16/2024 |
0.12.8 | 82 | 7/14/2024 |
0.12.7 | 90 | 7/14/2024 |
0.12.6 | 83 | 7/13/2024 |
0.12.5 | 122 | 7/7/2024 |
0.12.4 | 109 | 7/6/2024 |
0.12.3 | 98 | 7/3/2024 |
0.12.2 | 104 | 6/29/2024 |
0.12.1 | 91 | 6/9/2024 |
0.12.0 | 126 | 5/26/2024 |
0.11.18 | 104 | 5/18/2024 |
0.11.17 | 119 | 4/19/2024 |
0.11.16 | 127 | 4/14/2024 |
0.11.15 | 137 | 4/9/2024 |
0.11.14 | 112 | 4/7/2024 |
0.11.13 | 112 | 4/7/2024 |
0.11.12 | 126 | 4/7/2024 |
0.11.11 | 135 | 4/1/2024 |
0.11.10 | 144 | 3/31/2024 |
0.11.9 | 124 | 3/30/2024 |
0.11.8 | 106 | 3/30/2024 |
0.11.7 | 135 | 3/29/2024 |
0.11.6 | 121 | 3/24/2024 |
0.11.5 | 160 | 3/13/2024 |
0.11.4 | 206 | 3/6/2024 |
0.11.3 | 199 | 3/1/2024 |
0.11.2 | 149 | 2/29/2024 |
0.11.1 | 228 | 2/19/2024 |
0.11.0 | 182 | 2/16/2024 |
0.10.1 | 206 | 2/15/2024 |
0.10.0 | 264 | 2/11/2024 |
0.9.7 | 245 | 2/10/2024 |
0.9.6 | 247 | 2/8/2024 |
0.9.5 | 287 | 2/2/2024 |
0.9.4 | 225 | 2/1/2024 |
0.9.3 | 250 | 1/31/2024 |
0.9.2 | 282 | 1/24/2024 |
0.9.1 | 267 | 1/20/2024 |
0.9.0 | 312 | 1/19/2024 |
0.8.4 | 536 | 11/17/2023 |
0.8.3 | 423 | 11/11/2023 |
0.8.2 | 412 | 11/2/2023 |
0.8.1 | 426 | 11/1/2023 |
0.7.2 | 456 | 10/19/2023 |
0.7.1 | 483 | 9/21/2023 |
0.7.0 | 533 | 9/12/2023 |
0.6.5 | 576 | 8/29/2023 |
0.6.4 | 560 | 8/26/2023 |
0.6.3 | 496 | 8/26/2023 |
0.6.2 | 533 | 8/19/2023 |
0.6.1 | 511 | 8/19/2023 |
0.6.0 | 519 | 8/17/2023 |
0.5.1 | 530 | 8/16/2023 |
0.5.0 | 538 | 8/12/2023 |
0.4.0 | 563 | 5/28/2023 |
0.3.0 | 686 | 2/12/2023 |
0.2.109 | 794 | 2/5/2023 |
0.2.108 | 919 | 10/18/2022 |
0.2.107 | 995 | 10/15/2022 |
0.2.106 | 1,046 | 10/12/2022 |
0.2.105 | 964 | 10/11/2022 |
0.2.104 | 1,006 | 9/25/2022 |
0.2.103 | 1,059 | 9/25/2022 |
0.2.98 | 1,012 | 9/25/2022 |
0.2.97 | 1,027 | 9/25/2022 |
0.2.24 | 783 | 11/30/2021 |
0.2.23 | 840 | 11/27/2021 |
0.2.22 | 2,512 | 11/27/2021 |
0.2.21 | 3,474 | 11/25/2021 |
0.2.20 | 930 | 11/12/2021 |
0.2.19 | 792 | 11/11/2021 |
0.2.15 | 853 | 11/9/2021 |
0.2.13 | 842 | 11/8/2021 |
0.2.3 | 899 | 11/4/2021 |
0.2.1 | 866 | 11/3/2021 |
0.2.0 | 862 | 11/1/2021 |
0.1.1 | 895 | 9/26/2021 |
0.1.0 | 928 | 9/26/2021 |