-
Notifications
You must be signed in to change notification settings - Fork 20
HelloWorldProjectionFSharp
Yves Reynhout edited this page May 29, 2016
·
2 revisions
If you're using F#, a lot of what Projac offers (to C#) is already present in your language. In fact, except when you're targeting a relational store, you don't really need Projac. Obviously, you will still want to take advantage of the techniques presented here.
Before you can write projections, you need to define the messages you are going to project. Record types are a very common way to define them in F#. For simplicity sake, we'll define our first message as follows.
[<CLIMutable>]
type PeopleWhoSaidHello = { People: string array };
This message captures a list of people, their names, that said hello. Pretty useless in and by itself, but useful enough for a Hello World
.
Defining a projection in F# is just a matter of defining a function, like so: