本文整理匯總了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));
});
}