Autofac - How to create a generated factory with parameters
问题 I am trying to create with Autofac a 'generated' factory that will resolve dependencies in real-time based on an enum parameter. Given the following interfaces/classes : public delegate IConnection ConnectionFactory(ConnectionType connectionType); public enum ConnectionType { Telnet, Ssh } public interface IConnection { bool Open(); } public class SshConnection : ConnectionBase, IConnection { public bool Open() { return false; } } public class TelnetConnection : ConnectionBase, IConnection {