This is what I want from DI container:
public class Class
{
public Class(IDependency dependency, string data) { }
}
var obj = di.Resolve<Class>(() => new Class(null, "test"));
Points of interest:
- Can resolve both dependency and data in constructor.
- Can use type-safe syntax to pass constructor parameters (exact syntax may vary). Yes I can do it myself by getting constructor arguments from (Expression.Body as NewExpression) - but I'll need a way to detect what arguments are registered in the container.
Another major requirements is that I'd like my components to be automatically picked up, i.e. I don't want to register Class - I want IoC to pick it up because it knows how to resolve IDependency.
Also, Property Injection can be useful sometimes, but this is optional.
The question is really about the combination of features - to have all of them - type-safe, parameters, automatic pick-up... It's easy to check one feature, but a combination of them is not easy to verify unless one's familiar with particular container and knows its features. Thus the question.