This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace FiveMinuteProject | |
{ | |
public class ProjectionBuilder<TState> | |
{ | |
private readonly ProjectionHandler<TState>[] _handlers; | |
public ProjectionBuilder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Security.Policy; | |
using Newtonsoft.Json; | |
using Raven.Client; | |
using Raven.Client.Embedded; | |
namespace FiveMinuteProject | |
{ | |
public class ProjectionBuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System; | |
open Projac; | |
type PortfolioCreated = { PortfolioId : int; Name : string } | |
type PhotoAddToPortfolio = { PortfolioId : int; PhotoId : int } | |
type PhotoRemovedFromPortfolio = { PortfolioId : int; PhotoId : int } | |
type PortfolioArchived = { PortfolioId : int; Name : string } | |
let PortfolioProjection (message:Object) = | |
seq { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class PlaceHolderForProjections { | |
public static readonly PortfolioProjection = TSql.Projection(). | |
When<PortfolioAdded>(@event => | |
TSql.NonQuery( | |
"INSERT INTO [Portfolio] (Id, Name) VALUES (@P1, @P2)", | |
new { P1 = TSql.Int(@event.Id), P2 = TSql.NVarChar(@event.Name, 40) } | |
). | |
When<PortfolioRemoved>(@event => | |
TSql.NonQuery( | |
"DELETE FROM [Portfolio] WHERE Id = @P1", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Projac; | |
using Paramol.SqlClient; | |
public namespace AliensNeverOnceAbductedMe | |
{ | |
public static class PortfolioProjection | |
{ | |
public static readonly SqlProjectionDescriptor Descriptor = | |
new SqlProjectionDescriptorBuilder("portfolio-v1") | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Paramol.SqlClient; | |
namespace Paramol.Tests.SqlClient | |
{ | |
public class ParameterCountLimitedExceeded | |
{ | |
public static readonly ParameterCountLimitedExceeded Instance = new ParameterCountLimitedExceeded(); | |
private ParameterCountLimitedExceeded() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Reactol; | |
//Fictitious scenario: | |
//Add an entry in the feed of a subscriber each time | |
//someone writes a blog post on a blog he's subscribed to. | |
var subscriptions = new SubscriptionRepository(/* ommitted */); | |
var reaction = new ReactionBuilder(). | |
When<BlogPostWritten>(message => subscriptions. | |
FindForBlog(message.BlogId). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Original technique courtesy of | |
//- http://scott.willeke.com | |
//- http://blogs.pingpoet.com/overflow/archive/2005/07/20/6607.aspx | |
//- https://devio.wordpress.com/2007/12/05/parsing-xhtml-with-c/ | |
//- http://sticklebackplastic.com/post/2007/06/28/How-to-use-XmlResolver-Or-reading-an-xhtml-file-in-net.aspx | |
public static class XhtmlParser | |
{ | |
public static XmlDocument Parse(string xhtml) | |
{ | |
using (var textReader = new StringReader(xhtml)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |