Skip to content

Instantly share code, notes, and snippets.

View jkonecki's full-sized avatar

Jakub Konecki jkonecki

  • ServiceWare Ltd
  • London, United Kingdom
View GitHub Profile
@jkonecki
jkonecki / StreamStoneGrain.cs
Created December 26, 2016 21:00
JournaledGrain + SS
/*
https://github.com/dotnet/orleans/blob/master/src/OrleansEventSourcing/JournaledGrainState.cs
The example from Orleans repo uses existing providers to store the event stream as List<Event>.
This is not needed when using StreamStone - instead of using existing providers and calling WriteStateAsync() you can read / write yourself
*/
// 1. Define class that will be used by StreamStone to represent event row
public class EventEntity : TableEntity
{
@jkonecki
jkonecki / ConcreteState.cs
Last active November 10, 2018 03:11
Orleans EventSourcing design
using System.Threading.Tasks;
using Orleans;
namespace MyApp
{
public class MyState
{
public string Foo { get; set; }
public int Bar { get; set; }
}
@jkonecki
jkonecki / RavenDBTransientErrorDetectionStrategy
Created October 10, 2014 09:30
Transient error detection strategy for RavenDB using Microsoft.Practices.TransientFaultHandling application block
using Microsoft.Practices.TransientFaultHandling;
public class RavenDBTransientErrorDetectionStrategy : ITransientErrorDetectionStrategy
{
public bool IsTransient(Exception ex)
{
dynamic currentException = ex;
while(currentException != null)
{
@jkonecki
jkonecki / gist:20be888e1d77555dcf0e
Last active August 29, 2015 14:00
Orleans event sourced state
// Events
public class PersonRegistered
{
public string FirstName { get; set; }
public string LastName { get; set; }
public GenderType Gender { get; set; }
}
public class PersonMarried
{