Publisher | Max Karepin |
---|---|
File size | 109.22kB |
Number of files | 101 |
Latest version | 1.0.3 |
Latest release date | 2023-06-08 04:01:12 |
First release date | 2023-06-08 04:01:12 |
Supported Unity versions | 2018.4.2 or higher |
EasyJection implements dependency injection without using any attributes (like [inject] etc). Such an implementation avoids tying your project code to the framework. Write your code without direct dependencies on the framework itself. You will not have to include framework's namespaces everywhere.
- Since when the attributes (as well as the namespace) are used in your project's class, that class, at least indirectly, begins to know about where it gets its dependency from.
This project is open source: https://github.com/imaxs/EasyJection
Why use it?
Dependency Injection (DI) is an intimidating word for a simple concept you're likely familiar with. Dependency Injection in simple words, is a software design concept that allows a service to be injected in a way that is completely independent of any client consumption. Dependency Injection separates the creation of a client's dependencies from the client's behavior, which allows program designs to be loosely coupled. A DI container, in pair with a good architecture, can ensure SOLID principles and help you write better code.
EasyJection allows you to write much more flexible, reusable and encapsulated code.
Key Features:
- Injection Mechanisms
- Standard C# objects (a.k.a. POCO)
- Constructor injection
- Method injection
- Field injection
- Property injection
- Parameter injection
- Inherited from MonoBehaviour
- Constructor injection (as the Unity documentation says, you shouldn't implement and call constructors for MonoBehaviours. Unity automatically invokes the constructor.)
- Method injection (through Awake() and Start(), or other custom methods)
- Field injection
- Property injection
- Parameter injection
- Can inject on non public members.
- Convention based binding.
- Conditional binding (eg. by method name, by signature, etc.)
- Context Aware Injection Support (dependencies can be automatically injected using the components contained in the child and parents)