• Stars
    star
    830
  • Rank 54,579 (Top 2 %)
  • Language
    C#
  • License
    MIT License
  • Created over 13 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An easy to use, hassle free, Inversion of Control Container for small projects, libraries and beginners alike.

Build status NuGet Version

Welcome to TinyIoC

Overview

Welcome to TinyIoC - an easy to use, hassle free, Inversion of Control Container. TinyIoC has been designed to fulfil a single key requirement - to lower the "level of entry" for using an IoC container; both for small projects, and developers who are new to IoC who might be "scared" of the "big boys"!

To that end, TinyIoC attempts to stick to the following core principals:

  • Simplified Inclusion - No assembly to reference, no binary to worry about, just a single cs file you can include in your project and you're good to go. It even works with both Mono and MonoTouch for iPhone development!
  • Simplified Setup - With auto-resolving of concrete types and an "auto registration" option for interfaces setup is a piece of cake. It can be reduced to 0 lines for concrete types, or 1 line if you have any interface dependencies!
  • Simple, "Fluent" API - Just because it's "Tiny", doesn't mean it has no features. A simple "fluent" API gives you access to the more advanced features, like specifying singleton/multi-instance, strong or weak references or forcing a particular constructor.

In addition to this, TinyIoC's "simplified inclusion" makes it useful for providing DI for internal library classes, or providing your library the ability to use DI without the consuming developer having to specify a container (although it's useful to provide the option to do so).

Note For ASP.Net per-request lifetime support you will need to also include TinyIoCAspNetExtensions.cs, and the TinyIoC namespace. This provides an extension method for supporting per-request registrations. It's an extra file, but it's preferable to taking a dependency on Asp.Net in the main file, which then requires users to setup #DEFINEs for non-asp.net platforms.

Key Features

  • Simple inclusion - just add the CS file (or VB file coming soon!) and off you go.
  • Wide platform support - actively tested on Windows, Mono, MonoTouch, PocketPC and Windows Phone 7. Also works just fine on MonoDroid.
  • Simple API for Register, Resolve, CanResolve and TryResolve.
  • Supports constructor injection and property injection. Constructors are selected automatically but can be overridden using a "fluent" API.
  • Lifetime management - including singletons, multi-instance and ASP.Net per-request singletons.
  • Automatic lazy factories - a Func dependency will automatically create a factory.
  • RegisterMultiple/ResolveAll/IEnumerable support - multiple implementations of an interface can be registered and resolved to an IEnumerable using ResolveAll, or taking a dependency on IEnumerable.
  • Child containers - lifetime can be managed using child containers, with automatic "bubbling" of resolving to parent containers where required.

More Repositories

1

TinyMessenger

A lightweight event aggregator/messenger for loosely coupled communication.
C#
284
star
2

Sublime-Notepad-Replacement

A simple launcher app to allow Sublime Text to replace Notepad on Windows.
C++
130
star
3

SuperSimpleViewEngine

Super simple regex based view engine used in Nancy diagnostics and (soon to be) TinyTemplates.
C#
36
star
4

pico8vscodeeditor

A plugin for VSCode for Pico8 development, with basic Lua language and Pico8 API support.
TypeScript
24
star
5

NancyInAKayak

Simple demo showing Nancy hosted in Kayak and serving a Razor view
C#
10
star
6

NancyAnna

Simple test of running Nancy on top of Anna ( https://github.com/jfromaniello/Anna )
C#
8
star
7

Argh

A basic async HTTP test/benchmark/stress tool. Async Request Generator for HTTP ;-)
C#
7
star
8

NancyHtmlTagsTest

Quick test to use Fubu's HtmlTags to generate editors in Nancy views
C#
6
star
9

TinyTemplates

C#
6
star
10

WPF-Composite-Application-Dynamic-Skin-Switching

A demo app showing a way to provide runtime skin switching in a WPF composite application while maintaining "Blendability"
C#
4
star
11

PortablePuTTY

PuTTY ( http://www.chiark.greenend.org.uk/~sgtatham/putty/ ) with portable file based settings.
C++
3
star
12

RFC2047-Encoded-Word-Encoder-Decoder

Simple static encoder/decoder for RFC2047 "Encoded Word" text - supports Q and B encoding and decoding, and handles line splitting as per the spec.
C#
3
star
13

MEF-Plugin-With-Custom-Attributes-and-Metadata-Sample

Simple project to show how MEF can be used to create plugins. Uses custom attributes (rather than default MEF ones), metadata and lazy loading.
C#
2
star
14

DbMailer

Simple tool for executing a SQL statement and emailing the results as a CSV
C#
2
star
15

Owin.AutoStartup

Automatic configuration of AutoStartup compatible OWIN middlewares for compatible hosts.
C#
2
star
16

Feegle.Validation

Experiments in a 'fluent' API for method parameter validation
C#
1
star
17

Isochronal

Very simple jQuery plugin for AJAX short polling.
JavaScript
1
star
18

SuperDuperHappyPath

Powershell scripts / nuget package for getting aboard the super duper happy path
1
star
19

FizzBuzzLinq

Stupid one liner FizzBuzz using LINQ.
C#
1
star
20

MicrosoftHealthFitbitSync

1
star
21

RFC5987-Decoder

Decoder for the header field encoding defined in RFC5987 / RFC2231.
C#
1
star
22

ConfigHelper

Config helper class for loading a config from file if it exists.
C#
1
star
23

AmazonSecureDownload

Sample C# code for generating secure download URLs from AWS S3 and CloudFront
C#
1
star
24

WPF-Saveable-Code-Based-Animations

ViewModel friendly "code based" animations with support for saving state.
C#
1
star
25

LogPerf

Quick test of logging performance comparing string params with callbacks.
C#
1
star
26

WPF-Animatable-Property-Adapter

ViewModel friendly adapter for being able to get current values from an item being animated.
C#
1
star
27

Keepass.AutoSync

Keepass plugin for automatically syncing the database file when its updated on disk (for dropbox/skydrive dbs)
C#
1
star
28

NancyLikesBatman

JavaScript
1
star