public class Person
{
public string LastName { get; set; }
public string MiddleName { get; set; }
public string FirstName { get; set; }
}
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 MediatorPipeline<TRequest, TResponse> | |
: IRequestHandler<TRequest, TResponse> | |
where TRequest : IRequest<TResponse> | |
{ | |
private readonly IRequestHandler<TRequest, TResponse> _inner; | |
private readonly IEnumearble<IMessageValidator<TRequest>> _validators; | |
private readonly IMessageAuthorizer _authorizer; | |
private readonly IEnumerable<IPreRequestProcessor<TRequest>> _preProcessors; | |
private readonly IEnumerable<IPostRequestProcessor<TRequest, TResponse>> _postProcessors; | |
private readonly IEnumerable<IResponseProcessor<TResponse>> _responseProcessors; |
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 ಠ_ಠAttribute : Attribute | |
{ | |
} | |
[ಠ_ಠ] | |
public class Manager | |
{ | |
// 1000s of lines here | |
} |
Request Handler....................................................Y
-Void Request Handler...............................................N
+Void Request Handler...............................................Y
Pipeline Behavior..................................................Y
Pre-Processor......................................................Y
Post-Processor.....................................................Y
-Constrained Post-Processor.........................................N
+Constrained Post-Processor.........................................Y
Ordered Behaviors..................................................Y
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
private static IEnumerable<DateTime> AllMondaysInJune2020 { get { | |
yield return new DateTime(2020, 6, 1); | |
yield return new DateTime(2020, 6, 8); | |
yield return new DateTime(2020, 6, 15); | |
yield return new DateTime(2020, 6, 22); | |
yield return new DateTime(2020, 6, 29); | |
} | |
} |
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 interface IValidator<in T> { | |
} | |
public class CompositeValidator<T> : IValidator<T> { | |
public CompositeValidator(params IValidator<T>[] validators) { | |
} | |
} |
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 interface IDomainEventDispatcher | |
{ | |
void Dispatch(IDomainEvent domainEvent); | |
} | |
public class DomainEventDispatcher : IDomainEventDispatcher | |
{ | |
private readonly IContainer _container; | |
public DomainEventDispatcher(IContainer container) |
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
private static readonly Expression<Action<IField>> IFieldApplyMethod = | |
f => f.Apply(default, default); | |
private static readonly MethodInfo IFieldApplyMethodInf = | |
((MethodCallExpression)IFieldApplyMethod.Body).Method |
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
GET /invoices | |
200 OK | |
{ | |
[ | |
{ | |
"@id": "/invoices/123", | |
"status": 0, | |
"total": 199.99, | |
"actions": [ | |
{ "approve": "/invoices/123/approve" } |
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 interface IDocumentRepository<T> where T : IAggregate { | |
// we expose IMongoQueryable directly because it has Mongo-specific methods | |
IMongoQueryable<T> Query(); | |
Task<T> Get(Guid id); | |
Task Save(T document); | |
Task Update(T document, Expression<Func<T, bool>> filter); | |
Task Update(T document); | |
IMongoCollection<T> Collection { get; } | |
} |