【发布时间】:2011-02-05 10:05:15
【问题描述】:
我正在尝试弄清楚如何设置 StructureMap(使用 XML 配置文件)。一个类有一个构造函数,其中包含一个包含第二类实例的列表:
public interface ITestDocType { }
class TestDocType : ITestDocType
{
public List<AttributeRef> AttrRefs { get; set; }
public TestDocType(List<AttributeRef> attrRefs)
{
AttrRefs = attrRefs;
}
}
public class AttributeRef
{
public AttributeRef(string name, string xpath, string value)
{
Name = name;
Xpath = xpath;
Value = value;
}
public string Name { get; set; }
public string Xpath { get; set; }
public string Value { get; set; }
}
我希望能够在我的配置文件中内联 AttributeRef 的实例,但不完全确定它是如何完成的(或者如果可能的话)。
<DefaultInstance PluginType="ITestDocType" PluggedType="TestDocType">
<attrRefs>
// Would like to specify one to many AttributeRef instances inline here
</attrRefs>
</DefaultInstance>
【问题讨论】:
标签: c# structuremap