-
Notifications
You must be signed in to change notification settings - Fork 0
jmcd/YATC
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Yet another tiny container. A wee IoC container I wrote for fun and learning.
Use it like so:
public interface IService {}
public interface ICache<T> {}
public class MyService : IService
{
public MyService(ICache<string> cache){}
}
public class Cache<T> : ICache<T>
{
public Cache(IList<string> store){}
}
var container = new Container()
.Register<IService, MyService>() // Register class for interface
.Register<ICache<string>, Cache<string>>(Lifestyle.Singleton) // Register specific type of open-generic, also make it singleton
.Register<IList<string>>(() => new List<string>()) // Register implentation by factory method
;
var service = container.Resolve<IService>();
About
Yet another tiny (IoC) container
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published