StructureMap3 How to configure constructor string injection for all types?
问题 I have registered my types using Scan( scan => { scan.TheCallingAssembly(); scan.WithDefaultConventions(); scan.With(new ControllerConvention()); }); But how do I specify for constructor injection with out having to specify the concrete type like this? string connStr = "..."; For<IRepository().Use<MyRepository>().Ctor<string>("connectionString").Is(connStr); 回答1: You can create dedicated convention for registration of repositories. public class RepositoryConvention : IRegistrationConvention {