View CacheClientTests.cs
using System;
using System.Threading.Tasks;
using Microsoft.Azure.Documents.Client;
using Shouldly;
using Xunit;
namespace Demo
{
public class CachingTests
{
View CacheClient.cs
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Extensions.Caching.Memory;
namespace Demo
{
public static class DocumentDbCacheClient
View document.json
{
"id": "16f030f6-1d0e-4d4c-802c-38ce101c8bd2",
"Name": "Demo",
"_rid": "kTAFAKBy7QEBAAAAAAAAAA==",
"_self": "dbs/kTAFAA==/colls/kTAFAKBy7QE=/docs/kTAFAKBy7QEBAAAAAAAAAA==/",
"_etag": "\"00002901-0000-0000-0000-58ae2d380000\"",
"_attachments": "attachments/",
"_ts": 1487809848
}
View OptimisticConcurrency.cs
using System;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Shouldly;
using Xunit;
namespace Demo
View usage.cs
var subscriberCode = (from x in subscribers
where x.Number.ToUpperInvariant() == number.ToUpperInvariant()
select x.SubscriberCode).PrimitiveSingleOrMaybe(i => i > 0);
View register.cs
var busBuilder = new BusBuilder()
// Global Handlers
.RegisterGlobalHandler<LoggingHandler>()
// Scan an assembly for all other command/query/event handlers
.RegisterHandlers(assembly);
autofacContainerBuilder.RegisterMicroBus(busBuilder);
View xcutting.cs
public interface IDelegatingHandler
{
Task<object> Handle(INextHandler next, object message);
}
public interface IPipelineHandler
{
Task<object> Handle(Func<IMessage, Task<object>> next, IMessage message);
}
View CommmandHandler.cs
public class PaymentCommand : ICommand { }
public class PaymentHandler : ICommandHandler<PaymentCommand>
{
public async Task Handle(PaymentCommand command)
{
// Do some stuff...
}
}
View ICommandQueryEvent.cs
public interface ICommand : IMessage { }
public interface IQuery<in TQuery, out TResult> : IQuery, IMessage where TQuery : IQuery<TQuery, TResult> { }
public interface IQuery { }
public interface IEvent : IMessage { }
View cmd.fs
type Command = { Id:int; Name:string }