This file contains hidden or 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.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| namespace PipelineDemo | |
| { | |
| // http://www.rantdriven.com/post/2009/09/16/Simple-Pipe-and-Filters-Implementation-in-C-with-Fluent-Interface-Behavior.aspx | |
| public interface IFilter<TContext> | |
| { |
This file contains hidden or 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
| namespace Analogy | |
| { | |
| /// <summary> | |
| /// This example shows that a library that needs access to target .NET Standard 1.3 | |
| /// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET | |
| /// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library. | |
| /// </summary>INetCoreApp10 | |
| class Example1 | |
| { | |
| public void Net45Application(INetFramework45 platform) |
This file contains hidden or 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
| f(events) -> state | |
| match f(state, event) -> state | |
| f(state, command) -> events |
This file contains hidden or 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
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |
This file contains hidden or 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 Indexer | |
| { | |
| private readonly Dictionary<string, List<string>> terms = | |
| new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); | |
| private readonly Dictionary<string, List<string>> docsTerms = | |
| new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase); | |
| public void Index(string docId, string text) | |
| { | |
| List<string> docTerms; |
This file contains hidden or 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 string GetVirtualPath(VirtualPathContext context) | |
| { | |
| foreach (var matcherParameter in _matcher.Template.Parameters) | |
| { | |
| context.Values.Remove(matcherParameter.Name); // make sure none of the domain-placeholders are appended as query string parameters | |
| } | |
| return _innerRoute.GetVirtualPath(context); | |
| } |
This file contains hidden or 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 EventSubscriber : IEventSubscriber | |
| { | |
| private IReadModelPersistence _persistence; | |
| public void CatchUpAndSubscribe (IEventBus eventBus, IEventStore eventStore) | |
| { | |
| CatchUpUntilNow(eventStore); | |
| eventBus.Subscribe (this); | |
| CatchUpUntilNow(eventStore); | |
| } |
This file contains hidden or 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
| internal class MassTransitDispatcher : IObserver<ICommit> | |
| { | |
| private readonly IServiceBus _bus; | |
| public MassTransitDispatcher(IServiceBus bus) | |
| { | |
| _bus = bus; | |
| } | |
| public void Dispose() |
This file contains hidden or 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 TransactionalInvoker : IEnlistmentNotification | |
| { | |
| bool _inTransaction; | |
| readonly List<Action> _commitActions = new List<Action>(); | |
| public void Invoke(Action action) | |
| { | |
| if (_inTransaction) | |
| { | |
| _commitActions.Add(action); |
This file contains hidden or 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
| readonly ICollection<Action> _transactionCallbacks = new Collection<Action>(); | |
| public override int SaveChanges() { | |
| int r; | |
| try { | |
| ExecuteDomainEvents(); | |
| r = base.SaveChanges(); | |
| } catch (Exception) { | |
| _transactionCallbacks.Clear(); | |
| throw; |