Skip to content

Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Follow @CodeOpinion

ASP.NET

Linking to Nancy Routes

I’ve previously blogged about Nancy.Linker, the URI Builder for NancyFX.  However, I wanted to take it a step further and give an actual example of how I handle linking to Nancy routes through my application. Organize by Feature I organize my application by features.   Features are generally commands or queries.  They are either returning data (queries) or actions that represent behaviors (commands). This means that I generally only have one route per feature.  Since I organize by feature, this means that I put the Nancy module with the single route and then all subsequent code (commands or queries, handlers, models) in that… Read More »Linking to Nancy Routes

Hangfire Best Practice: Invoke by ID

In my previous post, I created a few extension methods for Hangfire and MediatR in order to enqueue an IRequest. However, it was not following Hangfire Best Practice. The purpose was to have the IRequest serialized entirely when calling Enqueue(), which would be stored in Hangfires storage. Then when the request would be invoked, Hangfire would deserialize the IRequest and call Mediators Send(). My functioning example worked as expected. However, Hangfire recommends making your job arguments small and simple. Best Practice Method invocation (i.e. a job) is serialized during the background job creation process. Arguments are converted into JSON strings using the TypeConverter… Read More »Hangfire Best Practice: Invoke by ID

Background Commands with MediatR and Hangfire

I’ve been using MediatR and Hangfire independently for awhile.  I’ve previously posted one solution on how you could use send Commands with MediatR and Hangfire. The solution I had come up with in that post was to get around the expression serialization issue with type parameters in MediatR’s Send<T>. IRequest<Unit> Because we are creating a a fire and forget command which will be run in the background, there will be no return value.  MediatR handles these types of requests by using the Unit type. When creating a command you will implement IRequest and your request handler will implement IRequestHandler<IRequest, Unit>.… Read More »Background Commands with MediatR and Hangfire