Inversion of Control

A comprehensive look at inversion of control and how to use common IoC containers
Course info
Rating
(1416)
Level
Intermediate
Updated
Aug 15, 2011
Duration
4h 11m
Table of contents
Dependency Inversion
Inversion of Control
Dependency Injection
Building an IoC Container
Using Unity
Using Castle Windsor
Using Structure Map
Using Ninject
Description
Course info
Rating
(1416)
Level
Intermediate
Updated
Aug 15, 2011
Duration
4h 11m
Description

In this course we will take a detailed look at inversion of control by tracing it back to the underlying principles and patterns it was based off. We will disect inversion of control by understanding dependency inversion, the types of inversion of control, and dependency injection. We will clarify the differences in these terminologies that are often used incorrectly by both junior and experienced developers. Finally we will pull it all together and create our own IoC container and examine some of the common IoC frameworks like Unity, Castle Windsor, StructureMap, and Ninject.

About the author
About the author

John Sonmez is the founder of Simple Programmer (http://simpleprogrammer.com), where he tirelessly pursues his vision of transforming complex issues into simple solutions

More from the author
Beginning Lua
Intermediate
2h 50m
2 Dec 2013
Beginning HTML 5 Game Development With Quintus
Intermediate
2h 52m
25 Oct 2013
Beginning HTML5 Apps For Firefox OS
Intermediate
2h 20m
17 Oct 2013
More courses by John Sonmez
Section Introduction Transcripts
Section Introduction Transcripts

Using Unity
Hi this is John Sonmez from Pluralsight and in this module we are going to be talking about how to use Unity. And Unity is basically a IoC container framework from Microsoft and we're going to cover how to use this and how to use this in your application. So in this module what we're going to cover is first an introduction to Unity, just a little bit of background on what Unity is and where it comes from. Then we are going to go into setting up the container. I'm going to show you how to use a Unity container and to set it up and this is a fairly easy process it's something that we've kind of already covered in the previous module. It's going to be very similar to what we had done when we created our own IoC container. Then I'm going to show you how to actually use the container, we're going to use our shopper credit card example and we're going to see how we would do that exact same example using Unity. Then we're going to cover managing the lifecycle, this is something that we hadn't covered before in the previous module on creating our own IoC container, because we had kind of ignored this aspect. And it's not necessarily a dependency injection required feature, but it is something that a lot of the IoC containers do allow for. So we're going to cover what managing the lifecycle looks like inside of Unity. And then finally I'm going to cover some of the other features that are kind of unique to Unity or that we hadn't covered in the previous parts in Unity just to give kind of a more complete view of the API of the Unity container.

Using Castle Windsor
Hi this is John Sonmez from Pluralsight and in this module we are going to be covering Using Castle Windsor. So let's go over what we're going to cover in this module. Well first we're going to talk about what is Windsor, what is Castle Windsor, and what is this thing all about. We're going to talk a little bit about this in the context of the IoC container that we had seen already which is Unity. Then we are going to go through some actual code and we are going to work through setting up the Windsor container. We're going to see what the difference is between setting up the Windsor container and setting up Unity container. I'm going to really focus here on some of the contrast and comparison between these two containers so you can really get a good idea of what to choose when you're going to use an IoC container in your project. Then I'm actually going to get into the usage of Windsor container and show you how to resolve your root object and to use the Windsor container. And then I'm going to show you how to manage the lifecycle of your objects using the Windsor container, which is going to be again, very similar to Unity. And then finally I'm going to try and walk through some of the differentiating features of Castle Windsor and we're going to kind of just overview some of the other features that we may have missed. And I'm going to wrap this up by doing a little bit of a comparison between Unity and Windsor.

Using Structure Map
Hi this is John Sonmez from Pluralsight and in this module we are going to be covering Using Structure Map. So let's take a look at what we are going to cover in this module on using the IoC container structure map. Well the first thing that we're going to do is we're going to talk about structure map, a little bit about the background, where it came from, and what the history of structure map is. Then we're going to go through, just like we did for Castle Windsor and for Unity, and we're going to show how to set up the container. We're going to get the container set up, we're going to register the classes, and the mappings inside the container. Then I'm going to show you how to use the container, we're going to use the same shopper example that we've been using. And I'm going to show you how to get things out of structure map. And you're going to find, as we're going through this third IoC container, that it's very similar that all of these really are operating on the same principles. Because it's a very simple concept, the inversion of control dependency injection and inversion of control containers. So, we'll show you how to do that. And then we'll go into managing lifecycle and again this is going to be very similar, but I'm going to show you how to do the lifecycle management in structure map. And then finally I'm going to go over some of the unique things about structure map and show you some other features that are available in structure map.

Using Ninject
Hi this is John Sonmez from Pluarlsight and in this module we're going to be talking about Using Ninject. So let's go over what we're going to cover in this module. Just like many of the other IoC container modules we're going to go through some of the basic things that will get you started with Ninject right away. So first I'm going to give you a brief introduction on Ninject, what is it, a little bit of the background, and kind of what separates from the rest of the IoC containers that we've seen. Then we're going to go through and we're going to use our shopper example again with our charge cards and we're going to set up the container for Ninject and show you how you can register your types inside there for dependency injection. And we're going to base this off of permanently using the simple case of constructor injection. Then we're going to go ahead and get something out of the container. I'm going to show you how to use the container and a couple ways that you can use the container to do dependency injection in your code. And then we're going to look at how you manage lifecycle Ninject and you're going to find that, again this is going to very similar to what you've seen before in the other IoC containers, but it's actually really, really simple Ninject. So I'm going to show you how to do that and then I'm going to discuss some of the other features that kind of make Ninject unique or just some of the things that are a little easier to do in Ninject that I think you'll find useful.