使用 Net 4.5.1 和 StructureMap 3.1.4
我有扩展抽象类的服务:
public abstract class Charting<T> {
protected readonly String baseConfigurationString;
public Charting(String baseConfigurationString)
{
this.baseConfigurationString = baseConfigurationString;
}
...
}
对于我想设置的每个具体服务baseConfigurationString。现在我正在为每个服务单独做:
public class MyRegistry : Registry
{
public MyRegistry()
{
Profile("Development", x => {
ForConcreteType<AveragePartySizeChart>().Configure.Ctor<String>("baseConfigurationString").Is(MyDbConfiguration.getBaseConnectionString());
...next service....about 6 total
});
}
}
无论如何,尽管抽象类具有通用限定符,但它通常会针对抽象类执行此操作吗?