本文整理汇总了C#中StructureMap.Graph.PluginFamily.AddPlugin方法的典型用法代码示例。如果您正苦于以下问题:C# PluginFamily.AddPlugin方法的具体用法?C# PluginFamily.AddPlugin怎么用?C# PluginFamily.AddPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StructureMap.Graph.PluginFamily
的用法示例。
在下文中一共展示了PluginFamily.AddPlugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: If_a_Memento_does_not_know_its_PluggedType_or_concreteKey_select_the_DEFAULT_Plugin
public void If_a_Memento_does_not_know_its_PluggedType_or_concreteKey_select_the_DEFAULT_Plugin()
{
var family = new PluginFamily(typeof (IGateway));
Plugin plugin = family.AddPlugin(typeof (TheGateway), Plugin.DEFAULT);
var memento = new MemoryInstanceMemento();
Assert.AreSame(plugin, memento.FindPlugin(family));
}
示例2: attachPlugin
private void attachPlugin(XmlElement pluginElement, PluginFamily family)
{
TypePath pluginPath = TypePath.CreateFromXmlNode(pluginElement);
string concreteKey = pluginElement.GetAttribute(CONCRETE_KEY_ATTRIBUTE);
string context = "creating a Plugin for " + family.PluginType.AssemblyQualifiedName;
_builder.WithType(pluginPath, context, pluggedType =>
{
if (concreteKey == string.Empty)
{
throw new StructureMapException(112, pluggedType.FullName);
}
Plugin plugin = family.AddPlugin(pluggedType, concreteKey);
pluginElement.ForTextInChild("Setter/@Name").Do(prop => plugin.Setters.MarkSetterAsMandatory(prop));
});
}