https://github.com/jeremylikness/portableioc
Portable IOC is a tiny thread-safe Inversion of Control container for Universal Windows Platform apps.
https://github.com/jeremylikness/portableioc
Last synced: about 2 months ago
JSON representation
Portable IOC is a tiny thread-safe Inversion of Control container for Universal Windows Platform apps.
- Host: GitHub
- URL: https://github.com/jeremylikness/portableioc
- Owner: JeremyLikness
- License: mit
- Created: 2016-05-02T12:47:28.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-14T17:38:34.000Z (almost 9 years ago)
- Last Synced: 2025-02-02T19:32:30.594Z (3 months ago)
- Language: C#
- Size: 30.3 KB
- Stars: 1
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Project Description
Portable IOC is a tiny thread-safe Inversion of Control container for
Universal Windows Platform apps.Portable IOC is a tiny (less than 200 lines of code) thread-safe and portable Inversion of Control container. It is designed to make it simple and easy to wire dependencies for client projects on the Universal Windows Platform (UWP). Features include:
* Dependency resolution
* Lifetime management (shared and non-shared copies)
* Supports both constructor and property injection
* Full control over registration - delete registrations and destroy shared copies as needed
* Multiple resolution support through a simple labelTo create an instance of the master container simply new it:
` IPortableIoC ioc = new PortableIoc(); `
The container will automatically register itself, so this is possible:
` IPortableIoC anotherIoCReference = ioc.Resolve(); `
To register an instance of IFoo that is implemented as Foo:
` ioc.Register(ioc => new Foo()); `
To register a specific instance of IFoo in a container called "container2" that is implemented as FooExtended:
` ioc.Register(ioc => new FooExtended(), "Container2"); `
To register an instance of IBar that depends on IFoo:
` ioc.Register(ioc => new Bar(ioc.Resolve()); `
If you are using property injection:
` ioc.Register(ioc => new Bar { Foo = ioc.Resolve() }); `
To resolve bar:
` IBar bar = ioc.Resolve(); `
To resolve bar from a named container:
` IBar bar = ioc.Resolve("Container2"); `
To resolve a non-shared copy of bar:
` IBar bar = ioc.Resolve(true); `
You can also unregister and destroy copies of objects.