Helping you solve those tough coding problems!
Learn some great web development and web design tips and techniques through recipes that clearly define the problem being solved with a working solution.
Popular Tags: cakephp | theory | optimization | javascript-development | asp-net | css | jquery-development | sql | ajax | c

Search:
Follow @endyourif rss Facebook LinkedIn

Web API Global Exception Handler using an ExceptionFilterAttribute filter Web API Global Exception Handler using an ExceptionFilterAttribute filter

Published on Apr 19, 2019 by Jamie Munro

Web API and MVC with C# offer stellar global filters that can be registered in the App_Start/FilterConfig.cs file. For Web API and MVC the global filters goes inside the RegisterGlobalFilters function. This function contains an override based on whether you are applying the filter to MVC or Web API. Today we are going to look at how to implement an extension filter of the ExceptionFilterAttribute.

Read more >

Tags: Uncategorized | ASP.NET | web api | exceptionattributefilter

Mixing Powershell and Git with powerful shortcut commands Mixing Powershell and Git with powerful shortcut commands

Published on Apr 16, 2019 by Jamie Munro

I use GitHub everyday. I don't like the UI, it's slow and cumbersome. So instead I use a combination of Powershell and posh-git; it's the only tools I use. In this article I'm going to show you how to create shortcut commands like merge2master and merge2dev that automate the repeatable tasks of maintaining a development and master branch with GitHub.

Read more >

Tags: Uncategorized | powershell | git

10 year anniversary of End Your If! 10 year anniversary of End Your If!

Published on Feb 11, 2019 by Jamie Munro

I cannot believe this blog started 10 years ago today. My first post was called:†YSlow - Helping slow web pages load faster. I honestly do not even know if that technology is still used. I certainly haven't thought about it in more than 5 years.

I always find it fascinating to scan through my historical articles. Each year you can see a theme of what technology I was using when. For example, in 2012 I was posting heavily about Node.js.

In 2011 I self published my first book about CakePHP. That book would have never come together without this blog, as the very early articles were heavily focused on CakePHP. A PHP library I still use today for many of my sites.

During the 5th year anniversary in 2014 I was focused on using Ninject with MVC 4 followed by unit testing and test-driven development.

2015 contained a lot of great Knockout.js examples (which coincided with my book about the very subject).

In 2016 I apparently didn't blog once, yikes! In 2015 and the start of 2016 is when I wrote two books back-to-back and that was one of the most exhausting things I've ever done.

2017 and 2018 contains a large mix of C# and JavaScript.

So far 2019 is off to a good start with a wide variety of topics staying in my comfort zone of C#, JavaScript, CSS, and coming soon will be a few Git tips and tricks (my source control of choice).

To another 10 years!

Read more >

Tags: Uncategorized

Advanced Automatic Ninject Bindings Advanced Automatic Ninject Bindings

Published on Jan 13, 2014 by Jamie Munro

Problem


You have a common interface that is used by multiple concrete classes and you donít want to specify each Ninject binding manually.

Solution


The solution to this problem is very similar to my previous post on Automatic Ninject Bindings because it also leverages the NuGet package Ninject.extensions.conventions.

In this example, letís assume you have a single interface called IService<T>.† This interface contains a generic reference to a class or object (e.g. a database model).† Then you have multiple classes that implement the interface.† E.g. UserService : IService<User>.

With the following line of code, all of your classes that implement the IService interface will automatically bind to the corresponding class:


 ††††††††††† var kernel = new StandardKernel();

 ††††††††††† kernel.Bind(x =>

 ††††††††††† {

 †††† †††††††††††x.FromThisAssembly()

 ††††††††††††††††††† .SelectAllClasses()

 ††††††††††††††††††† .InheritedFrom(typeof(IService<>))

 ††††††††††† ††††††††.BindSingleInterface();

 ††††††††††† });

 

Read more >

Tags: Uncategorized | ASP.NET | c# | mvc | ninject