Skip to content

Instantly share code, notes, and snippets.

View yreynhout's full-sized avatar
👔
ceci n'est pas une cravate

Yves Reynhout yreynhout

👔
ceci n'est pas une cravate
View GitHub Profile
@yreynhout
yreynhout / Catch.cs
Last active April 17, 2020 14:32
Async Aggregate Source Command Handler Testing ... in a gist
using System;
using System.Threading.Tasks;
public static class Catch
{
public static async Task<Optional<Exception>> ExceptionAsync(Func<Task> action)
{
var result = Optional<Exception>.Empty;
try
{
public class EventRouter
{
private readonly Dictionary<Type, Action<object>> _handlers;
public EventRouter()
{
_handlers = new Dictionary<Type, Action<object>>();
}
public void Register<T>(Action<T> handler)
@yreynhout
yreynhout / AggregateSourceInGist.cs
Created May 5, 2015 16:59
AggregateSource in a gist
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace AggregateSourceInGist
{
public interface IEventRouter
{
@yreynhout
yreynhout / ConnectedProjection.cs
Created April 15, 2015 21:17
Projac Generic ConnectedProjection
/// <summary>
/// Represent a connected projection.
/// </summary>
public abstract class ConnectedProjection<TConnection>
{
private readonly List<ConnectedProjectionHandler<TConnection>> _handlers;
/// <summary>
/// Initializes a new instance of the <see cref="ConnectedProjection{TConnection}" /> class.
/// </summary>
using System;
using System.Net;
using NUnit.Framework;
using Projac.Redis;
using Recipes.Shared;
using StackExchange.Redis;
namespace Recipes.RedisIntegration
{
public class Usage
@yreynhout
yreynhout / AsyncProjector.cs
Last active August 29, 2015 14:18
Queue all projection requests - report back using TCS
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Projac;
namespace ConsoleApplication666
{
public class AsyncProjector
@yreynhout
yreynhout / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yreynhout
yreynhout / Program.cs
Created February 11, 2015 16:47
Order them sources
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace IAmScaredOfMonstersInTheDark
{
class Program
{
static void Main()
@yreynhout
yreynhout / AggregateReader.cs
Last active August 29, 2015 14:14
Goodbye repository, Hello aggregate reader!
public class AggregateReader
{
private readonly Func<IAggregateRootEntity> _rootFactory;
private readonly IEventStoreConnection _connection;
private readonly EventStoreReaderConfiguration _configuration;
public AggregateReader(
Func<IAggregateRootEntity> rootFactory,
IEventStoreConnection connection,
EventStoreReaderConfiguration configuration)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<system.data>
<DbProviderFactories>
<add name="SQLite Data Provider" invariant="System.Data.SQLite"
description="ADO.NET Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.94.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />