The core unit of data in Jinaga is a fact. A fact is an immutable record of an event, decision, or state change. Let's start simple. When the user logs into your application, that's a fact.
(User user, UserProfile profile) = await j.Login();
Each fact has a type (Jinaga.User
in this case) and a set of properties (publicKey
for this example).
The Jinaga.User
type is defined in the Jinaga library.
But, of course, you can define your own types.
Write a record and use the FactType
attribute to define a type.
[FactType("Construction.Project")]
public record Project(User creator, Guid id);
To create an instance of this fact, call j.Fact
.
This method is asynchronous because it will save the fact to the local store and notify the replicator to synchronize it with other clients.
Project projectA = await j.Fact(new Project(user, Guid.NewGuid()));