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

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

Logging in .NET with Exceptionless

There are plenty of options when it comes to logging in .NET.  NLog, log4net, Serilog are a few of the names you have likely heard.   One that I recently stumbled upon was Exceptionless. Complexity Logging shouldn’t be difficult.  But sometimes it sure feels that way. Generally, all I want to do is record various log messages through my application.  These could be handled or unhandled exceptions, debug logs with unstructured data, or just general informational logs such as feature usage. Exceptionless Exceptionless provides the means to persist all the types of logs that I mentioned above to a remote server.… Read More »Logging in .NET with Exceptionless