stiletto
stiletto copied to clipboard
Discover entry-points via codegen
Pros:
- remove stupid
Injects = new[] { typeof(Foo) }boilerplate
Cons:
- Inheritance complicates this
Container.Addcomplicates this- At some point, we have to determine just what modules are being added
- The common pattern of
base.OnCreate { Container.Add(GetModules()).Inject(this, GetType()); }seems hard to analyze reliably
- Generics? Ugh
This needs some deep thought. The API would be so much more usable, but only if codegen actually works beyond the 80% case. For example, how to support this;
public T Get<T>()
{
return this.Container.Get<T>();
}
Naively, we could just search the whole world for calls to Get, and look at their generic arguments. And what if those arguments are themselves generic? How deeply should we look?