Files

45 lines
1.1 KiB
Markdown

TOC:
- what GodotDI offers (in short):
- logging
- configuration
- possibility to attach extra DI-based services like telemetry)
- minimal description of what problems DI tackles
- minimal example with logging, configuration, decoupling of components
- how to install
- creation of the root service source
- example
- scopes
- why
- definition
- deep dive into why it's all done at composition root
- using extension methods to split the code as necessary
- sending data into a scope
- initializing data in the scope
NOTES
field with \[Inject\] or method with \[Inject\] automatically receive injection IF they are between the injected objects
of a ServiceSource
a method with \[WithProvider\] generates a companion method for unwrapping provider. E.g.:
```csharp
[WithProvider]
private void OnReady(IService1 service1, IService2 service2)
{
// ...
}
```
will generate a companion method similar to:
```csharp
private void OnReadyWithProvider(IProvider provider)
{
OnReady(
provider.Get<IService1>(),
provider.Get<IService2>()
);
}
```