Lars Wilhelmsen

Connected Systems MVP

Skip to: Content | Sidebar | Footer

Tinyject – IoC in an Evening

9 October, 2008 (15:52) | IoC, Pet+Projects, Tinyject | By: larsw

Last night, while hacking on the Aggressive project, I where in the need of a container. My initial idea was to try out Autofac, but since I was offline at the moment, I quickly hacked together a small container myself. Since I actually thought the look&feel of the interface was exactly what I wanted, I decided to put the source code in a separate project and give it a name; Tinyject. The code can be found here and is licensed under  the Apache License 2.0.

Features:

  • A Register() method in different flavors (including generic versions) for registering concrete types & interfaces in the type map.
    The Register() methods return this, so they can be chained.
  • A Resolve() method in different flavors (including generic versions) for resolving new and existing instances of registered types.
  • An idea of instance lifetime; Transient & Singleton.
  • Property, field and constructor injection.
  • The container implements System.IDisposable, and can be used in a using() { … } scope.
  • A static, thread-safe wrapper, TinyjectStatic.
  • A small number of xUnit-based unit tests to check the integrity of the stuff.

That’s it. At the moment there is no configuration system – and no extensibility points, but I believe the 2.0 version – maybe developed tonight after the baby swimming, will contain a simple extensible configuration model.

If anyone want to design a logo for it – please go ahead :-)

kick it on DotNetKicks.com

Share and Enjoy:
  • del.icio.us
  • DotNetKicks
  • Digg
  • Google Bookmarks
  • DZone

Comments

Pingback from Reflective Perspective – Chris Alcock » The Morning Brew #199
Time October 13, 2008 at 9:13 am

[...] Tinyject – IoC in an Evening – Lars Wilhelmsen had a need for a simple IOC container, so crafted a simple implementation in an evening. Lars hints at a version 2, and I look forward to seeing how this project progresses. [...]

Pingback from Weekly Links #23 | GrantPalin.com
Time October 19, 2008 at 8:53 pm

[...] Tinyject – IoC in an Evening Wow. Something so seemingly complex done in just a few hours. [...]

Write a comment