When I try to pass two parameters that are of the same type like so:
public IPercentage CreatePercentage(int part, int total)
{
return _container.Resolve<T>(new Arguments(part, total));
}
To a constructor like so:
public Percentage(int part, int total)
{
// ...
}
Then I get a System.ArgumentException: An item with the same key has already been added.
How can I pass arguments of same type?
It's absolutely doable, correct call according to documentation is:
_container.Resolve<IPercentage>(new Arguments(new { part, total }));
But the preferred way is to use the TypedFactoryFacility. You should never call container from your code except the entry point and/or composition root.