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
[TestFixture] | |
public class SpecificationFixture | |
{ | |
[Test, TestCaseSource("GetSpecificationTestCases")] | |
public void Verify(SpecificationToRun spec) | |
{ | |
var runner = new SpecificationRunner(); | |
RunResult result = runner.RunSpecifciation(spec); | |
if (result.Passed) |
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 SomeCommandHandler | |
{ | |
uow? where are you? | |
public void Handle(SomeCommand command) | |
{ | |
var agg = uow.GetById(command.AggId); | |
agg.Foo(); | |
} | |
} |
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 sealed class NServiceBusCommitDispatcher : IPublishMessages | |
{ | |
private const string AggregateIdKey = "AggregateId"; | |
private const string CommitVersionKey = "CommitVersion"; | |
private const string EventVersionKey = "EventVersion"; | |
private const string BusPrefixKey = "Bus."; | |
private readonly IBus bus; | |
public NServiceBusCommitDispatcher(IBus bus) | |
{ |
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
/* somewhere in your Core.CQRS */ | |
// Base class for all ES-based aggregate command handling components; | |
// | |
// NOTE: "Component" is a logical grouping of message handlers by function | |
// They provide good place to encapsulate chaining of cross-cutting concerns | |
// into a pipeline, providing simplified helper methods for registration of message handlers | |
// | |
// Components are similar to Services, thus they only contain handlers of single type (ie Command Handlers only) | |
// Components operate on envelope (infrastructure) level |
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 Dispatcher | |
{ | |
readonly Dictionary<Type, Func<object, object>> _dictionary = new Dictionary<Type, Func<object, object>>(); | |
public void Register<TMessage, TResult>(Func<TMessage, TResult> func) | |
{ | |
_dictionary.Add(typeof(TMessage), x => func((TMessage) x)); | |
} | |
public void Register<TMessage>(Action<TMessage> act) |
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
***************** | |
*** Use-Cases *** | |
***************** | |
Writing | |
#-----# | |
- Creating stream with given id and initial events | |
* Detect if stream with given id already exists |
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 void Start() | |
{ | |
ShowHelp(); | |
ShowVersion(); | |
SetQuiet(); | |
SetSilent(); | |
SetTrace(); | |
Initialize(); |
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
// NOTE: Add a COM reference to NetFwTypeLib | |
namespace Site.Setup | |
{ | |
using System; | |
using System.Linq; | |
using NetFwTypeLib; | |
/// <summary> |
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
[Reentrant("IsReentrant")] | |
public class SaveMentionBatcher : Actor | |
{ | |
public static bool IsReentrant(object message) => true; | |
public static TimeSpan FlushTimeout = TimeSpan.FromSeconds(10); | |
public static int BatchSize = 512; | |
readonly List<BufferItem> buffer = new List<BufferItem>(); | |
ActorRef topic; |
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
/* | |
This represents simple durable task which do some work in background. | |
The task is automatically saved after every successful transition. | |
It is modeled as workflow with the following transitions: | |
1. Initial -> Start -> Started | |
Accept user request and start preparation | |
2. Started -> Prepared -> Running | |
On activation of Started it schedules a one-off timer to delay actual execution of Prepare | |
to finish previous user request and return control to the caller (Orleans is RPC, so it's the hack) | |
3. Running -> Executed -> Running |
OlderNewer