/// <summary> /// Create instance of handler /// </summary> /// <param name="activator">The activator.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">$"Type {_t.FullName} doesn't implement {nameof(HandlerAttribute)}</exception> public (object instance, MethodInfo method)? Build(Type target, ICustomActivator activator) { if (!ContainsTarget(target)) { throw new NotImplementedException($"Type {_t.FullName} doesn't implement handler for {target.FullName}"); } var method = _targets[target]; var instance = activator.GetInstance(_t); if (instance is null || method is null) { return(null); } return(instance, method); }
public Container(ICustomActivator activator) { _activator = activator; _typesDictionary = new Dictionary <Type, Type>(); }