Archive for the ‘.Net’ Category

Got really bored looking this up every time

In startup.cs add the following

config.Services.Replace(typeof(IExceptionHandler), new MyExceptionHandler());
public class MyExceptionHandler : ExceptionHandler 
    public override void Handle(ExceptionHandlerContext context) 

Sometimes you just want to store stuff and not use it for traditional relation searches.

Ideally a NoSql solution would fit well in this scenario but don’t rule out Sql for a hybrid style solution.

You just have to be aware of certain limitations but otherwise the results are extremely pleasing.


To get the identity from the insert when using dapper return the SCOPE_IDENTITY

So far has been working reasonably well.

Example below:


NServiceBus, not my love affair

Posted: 2015-02-25 in .Net

I’ve been using NServiceBus for more than 3 years now.

In principle, NServiceBus is excellent. Saga’s are a huge time saver, as is guaranteed delivery and the piece of mind they provide.
My irk with NServiceBus is that it is simply more trouble than worth.

Random Reasons:


Unfortunately EnsureSuccessStatusCode is abit of a let down when it comes to Json rest. Most time Json query will have a descripton in the content on what actually went wrong. The easiest way wround this is to mimic the call and append on the result content with something like below: (more…)

I recently worked on a high profile site. One requirement was clear any failed issues leads us to legally liable. In many cases for large sums of money.

So to cover our butts we logged the entire incoming and outgoing SOAP messages.

Storage is cheap, law suits are not and an additional 0.050ms is easy to justify, especially as this enabled us code replay for problematic request.

So lets get started:


NServiceBus giving you grief?

If its “The type initializer for ‘NLog.Config.ConfigurationItemFactory’ threw an exception” then its probably a error in your app.config or web.config file….

There is no easy way to see what is failing so you may have to rely on version control