[# RESHARPER] AgentMulder: excellent AddIn to work with IoC

Buenas,

yesterday I commented on the availability of Unity for .net 4.5 and also made a comment on Agent Mulder . Agent Mulder is an awesome extension for ReSharper that allows you to navigate to a specific type declarations and implementations when we are working with some dependency injection container.

How to explain it in words I’m not well today, better go to an example. Suppose that we are working with Unity and have a with the following example console application:

   1: using System;
   2: using System.Diagnostics;
   3: using Microsoft.Practices.Unity;
   4:  
   5: namespace ConsoleApplication1
   6: {
   7:     class Program
   8:     {
   9:         static void Main(string[] args)
  10:         {
  11:             var container = new UnityContainer();
  12:             container.RegisterType<ILogger, LogDebug>();
  13:             var log = container.Resolve<ILogger>();
  14:             log.Log("sample data");
  15:             Console.ReadLine();
  16:         }
  17:     }
  18:     internal interface ILogger
  19:     {
  20:         void Log(string data);
  21:     }
  22:     class LogTrace: ILogger
  23:     {
  24:         public void Log(string data)
  25:         {
  26:             Trace.WriteLine(data);
  27:         }
  28:     }
  29:     class LogDebug : ILogger
  30:     {
  31:         public void Log(string data)
  32:         {
  33:             Debug.WriteLine(data);
  34:         }
  35:     }
  36: }

In the Visual Studio IDE, trying to see where the LogDebug class has been used is a bit craftsmanship, having no direct references, because it is a little complicated to know where you are using. If we see the help online that we since we will see something similar to the following in the code editor

image

Now if you download and install Agent Mulder , this plugin from ReSharper will show us that the class LogDebug() is registering and using with Unity. We can access registration of the same line and even then accessing dynamic references of ReSharper to see where it is implemented and use the Log() function.

image

In a few words Agent Mulder helps us to navigate between the references that we do with a dependency injector, as Unity, CastleWindsor, etc. The official website of the product sample is mounted on CastleWindsor .

Download: http://hmemcpy.github.com/AgentMulder/

Saludos @ La Finca

El Bruno

image image image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.