Dependency injection everywhere

Just a few years ago there was just few people who known what dependency injection is. Today it is almost everywhere. Recently I’ve discovered that it can be also used in Razor views – thanks to ASP.NET 5. I will try to show you how we can use that feature on few examples bellow. Probably each of you have been populating drop downs in Razor views with data send from controller.…

By Dawid on (tags: ASP.NET, dependency, injection, IoC, next, razor, categories: code)

Simple WCF. Hosting WCF service by Autofac in ASP.NET MVC 3

One of features of Autofac is that it can be used to host a WCF service. I have tried to host a WCF service within an already existing ASP.NET MVC 3 web application. The problem was that the service needed to use some resources which were managed by Autofac and was also used this MVC application. I spend few hours until I figure out what is going on and how to make it work toge…

By Mirek on (tags: Autofac, IoC, MVC 3, WCF, categories: code)

DI Containers – comparison

This blog shortly describes a few chosen DI containers and their out-of-the-box functionality. If a certain container does not have a specific platform listed, it doesn’t necessarily mean that it’s not possible to use it there – it just means that it’s not in the box. Castle Windsor License: Apache 2 Target platforms: .Net, Silverlight Complexity: Castle.Core, Castle.Windsor + …

By on (tags: IoC, categories: None)

Dependency Injection Containers

In a previous post, I tried to describe what inversion of control is. Here, we’ll take a look at the design pattern that helps with it. Dependency injection is a design pattern used to handle the problem of tight coupling between classes. Although it helps a lot, it’s not perfect. There are situations in which the pattern becomes cumbersome – the best example is probably nested…

By on (tags: IoC, categories: architecture)

A quick intro to IoC

There are two terms that have been loudly spoken for a while now IoC (Inversion of Control) and DI (Dependency Injection). In this post, I’ll try to sketch a picture of what these terms actually mean. IoC is an abstract principle regarding software construction that has been invented to fight the problem of tight coupling. Let’s take the following code sample: This looks like a…

By on (tags: IoC, categories: architecture)