NTracker

DI lightweight framework

Screen-cast demo: http://www.youtube.com/watch?v=XvieLnC1jhQ

Installation - Available on 

To install NTracker, run the following command in the Package Manager Console

PM> Install-Package NTracker

 

Sample classes

The default plugin's folder (dll with Broadcast attributes) is: YourProject/Bin/Debug or Release/Modules/

 

   using NTracker.Injection;
   
   public interface ISample
   { 
        string HelloWorld();
   }

 

   using NTracker.Injection;
   
   [Broadcast("contract")]
   public class Sample : ISample
   { 
        public string HelloWorld()
        {
             return "Hello world";
        }
   }

Injection of known dependencies (Lazy)

   using NTracker.Toolkit;
   using NTracker.Injection;
   
   public static void Main()
   { 
        // Configure DI
        this.Configure(Resolver.Default, null);
        this.UpdateInstances();

        // Resolve contract's injection
        IDependencyResolver resolver = new DefaultDependencyResolver();
        ISample sample = resolver.Resolve<Sample>("contract");
   }

Injection of unknown dependencies (Lazy)

   using NTracker.Toolkit;
   using NTracker.Injection;
   
   public static void Main()
   { 
        // Configure DI
        this.Configure(Resolver.Default, null);
        this.UpdateInstances();

        // Resolve contract's injection
        dynamic sample = this.LazyInstance("contract");

        // You can use the object without the referenced assembly
        sample.HelloWorld();
   }


Logo_30.png

License Apache version 2.0

Last edited May 4, 2012 at 6:39 AM by Crooby, version 21