Introduction
Sharpino is a little F# event sourcing framework. With Sharpino you can build an event sourced application using a functional approach. Two types of event sourced objects are supported: Contexts and Aggregates. Contexts: There is no specific id for a context so we just assume that a single instance and a single zero (initial state) instance exist for any Context. Aggregates: Many instances of an aggregate can exist at a time so we need an Id for each instance represented by a Guid. The initial state for any aggregate is its initial snapshot in the event store.
Contexts and aggregates will implement transformation members that will return a new object with a new state using the Result data type. We tipically use Railway oriented programming is used to handle errors in any transformation operation (by the FsTookit.ErrorHandling library).
We associate transformation members with events: processing an event will return a new object with a new state by invoking the transformation member associated with the event. Commands are function that given a state of a context/aggregate and some parameters will return a pari of a new state of the context/aggregate and the list of the events that, processed, will return such state.
Commands and events can be easily implemented using Discriminated Union types implementing the Command and the Event interfaces respectively.
This document is a guide to the Sharpino library. It is a work in progress. Focus on the following topics: Contexts, events, commands, service application layer, Event Store.
The sample application 1.
This application will be deprecated as it fails in showing the main features of the library.
Sample application 2. Booking system for seats in a stadium
Contexts represent rows. Some constraints are applied to the rows. The context is responsible for the seats. The seats are associated with the rows.
Sample application 3. Booking system for seats in a stadium
The same as application 2 but where rows are aggregates (so I can have any number of instances of seat rows). The application uses the SAFE based stack based template son can publish the system as a rest service using the Fable Remoting library.