Richard Feich

Rich's Blog

Dependency Injection and the Umbraco CMS Platform

On many projects I have used Ninject as my go-to dependency injection framework; it’s open source, flexible,  has good support, and a lot of extensions; but…it’s slow! Daniel Palme did some excellent work comparing the performance of various DI containers; see his results. Here is one of his conclusions supported by data:

Ninject is definitely the slowest container.

With this information I investigated using  the Simple Injector  DI framework. So far, I have used it on ASP.NET Web Forms, MVC, Web API, and console type applications. It’s a great simple super-fast DI framework, and its open source. I recommend trying it out [nuget  package].

Simple Injector is an easy-to-use Dependency Injection (DI) library for .NET 4+ that supports Silverlight, Windows Phone, Windows 8 including Universal apps and Mono. Simple Injector is easily integrated with frameworks such as Web API, MVC,  WCF, ASP.NET Core and many others. It’s easy to implement the dependency injection pattern with loosely coupled components using Simple Injector.”

I have been using Simple Injector in my custom Umbraco projects. Here is how it gets wired-up in the OnApplicationStarted() method:

using SimpleInjector;
using SimpleInjector.Integration.Web.Mvc;
using Umbraco.Core;
using Umbraco.Web.Mvc;


public class UmbracoEventHandler : IApplicationEventHandler

        public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            var appName = ConfigurationManager.AppSettings["ApplicationName"];
            var websiteUrl= ConfigurationManager.AppSettings["WebsiteUrl"];
            var connectionString = ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString;

            var memberRepoParms = new MembershipRepoParms
                ApplicationName = appName,
                WebsiteUrl = websiteUrl,
                ConnectionString = connectionString,
                ApplicationContext = applicationContext

            //Code for registering the repository class and DI
            // 1. Create a new Simple Injector container
            var container = new Container();

            // 2. Configure the container (register)
            container.Register<IMembershipRepository>(() => new MembershipRepository(memberRepoParms));
            container.Register<RenderMvcController>(() => new RenderMvcController());

            // 3. Verify your configuration -- optional

            // MVC Package - These two extension methods from integration package
            DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));

            // 4. Use the container examples -- this code go in your custom controllers.
            // var repository = container.GetInstance<IMembershipRepository>();
            // var repository = DependencyResolver.Current.GetService<IMembershipRepository>();


File Backup Solution

Problem: I have various files scattered over my entire C-drive (or any drive, folder or library), certain files I would like to backup and organize in someway. It is extremely tedious to click-through folders to find these files. I wrote a utility to automate the process; it’s a console app written in C#. Basically,  I point it to a source drive, I tell it what kind of files I want and  what to paths to ignore, and specify output organization structure…and let it run.

GitHub Repository:
It needs a bit more testing and code clean-up; but it’s functional and I’m using it.

A little bit of setup is required:

  • exclude.txt — contains a list of paths not to scan, for example:
    C:\Program Files
    C:\Program Files (x86)
    C:\Users\Rich\Documents\My Web Sites
    C:\Users\All Users
  • extensions.txt — contains a list of file extensions to look for, for example:
  • App.config settings:
    <add key=”SourceNode” value=”C:\” />
    <add key=”DestinationNode” value=”J:\FileBackup_temp” />
    <add key=”OrganizationFormat” value=”ByYear” />
    <add key=”UseMetadata” value=”true” />

SourceNode: the drive, library, or folder you wish to scan.
DestinationNode: where you wish to copy files to…the destination.
OrganizationFormat:   file organization at the destination, 4 possibilities

Flat — all files in one folder i.e. no hiearchy
ByYear — files organized by year of Create Date  (one level hierarchy)  ex. 2016
ByMonth — files organized by year and month of Create Date (two level hierarchy)  ex. 2016/Oct
ByDay — files organized by year, month, and date  of Create Date (three level hierarchy) ex. 2016/Oct/Oct03

UseMetadatatrue/false,  when set to true the Create Date will be pulled from metada (exif), if it exists. This is useful for digital photography.

I’ll improve this APP as needed for my purposes.

Umbraco CMS Platform

Umbraco is an open source content management system (CMS) platform written in C# built upon Microsoft’s .NET framework using ASP.NET MVC architectural model. Out-of -the-box, Umbraco is not a CMS per se, it’s really a platform for building a CMS; and an excellent one at that. I’ll been using this platform for 10+ years and I must say it has matured into a killer system for building websites and web-based applications. It has great architecture, super extensibility, and a fantastic development ecosystem (support, developers, plugins). Most importantly…the clients love the backoffice for managing content. The backoffice user-experience is fully customizable and components are implemented with AngularJS controllers and views.

To illustrate the power and extensibility of this system I am building a sample project and along the way I’ll explain various techniques and components. I am building an event management system, with grid calendars and event registration. More to come…


  • Hybrid Controllers (SurfaceRenderMvcController, RenderMvcController)
  • Dependency Injection using Simple Injector
  • Data access with Petapoco Micro-ORM and T4 templates
  • Strongly typed content access and views using Umbraco Models Builder
  • Responsive web design with Bootstrap
  • Google Maps integration
  • more…

Futura (typeface)

When I was a kid growing up in a small Wisconsin town, I remember riding my bicycle over to the local department store. At the end of the isle near the toy department there was a circular rack of pocket-sized books published by  “Golden Press”, typically edited or written by Dr. Herbert Zim;  the  Golden [science/nature] Guides . I loved these books; they were well written by experts in there field and covered a wide array of nature and science subject matter; they really fed my young curiosity at the time. When I could afford it, I would buy one of special interest to me, titles like: Photography, Color and Light, Rocks and Minerals, Oceanography, etc. I still have them in my library today.

As an adult, what is interesting about these books is the book design aspect. Each book is a highly readable package with simple straight-forward colorful illustrations, well laid out pages, good typography, organized into nourishing bites of information. The body copy typeface is Futura, which is a geometric sans-serif designed by Paul Renner and released in 1927 in Germany. Some may argue the Futura may not be the best choice for book body copy, but for this application it seems perfect. These books are pocket size,  set at a relatively small point. Futura is clean and elegant and has an appearance of efficiency and forwardness.

It consists of simple geometric forms: near-perfect circles, triangles and squares. It is based on strokes of near-even weight, which are low in contrast. The lowercase has tall ascenders, which rise above the cap line, and uses nearly-circular, single-storey forms for the “a” and “g”, the former previously more common in handwriting than in printed text.

“Futura is one of the most rhythmical sanserifs ever made. Its proportions are graceful and humane-close to those of Centaur in the vertical dimension. This helps to make it suitable for setting extended text.”

— Robert Bringhurst

Futura goes to the moon:

May this year give you the opportunity to follow your dreams, love like there is no tomorrow and smile unconditionally.

Happy New Year!


One cool cat.

Studying a Gold Finch

Happy Birthday!

Electronics Lab

On the bench is a 1945 Midland Radio Model M6B chassis; electronically restored and ready for RF alignment.

1945 Midland Radio Cabinet Refinished

After 6 coats of lacquer, with a bit of wet sanding between the finish coats…it looks pretty good. I ordered vintage style grill fabric, which will be carefully glued in-place on a supporting structure. I’m getting close to final assembly.

© 2018 Richard Feich