本文整理汇总了C#中StructureMap.Graph.PluginGraph类的典型用法代码示例。如果您正苦于以下问题:C# PluginGraph类的具体用法?C# PluginGraph怎么用?C# PluginGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginGraph类属于StructureMap.Graph命名空间,在下文中一共展示了PluginGraph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: validateInstance
private void validateInstance(IDiagnosticInstance instance, PluginFamily family, PluginGraph graph)
{
if (!instance.CanBePartOfPluginFamily(family))
{
graph.Log.RegisterError(104, instance.CreateToken(), family.PluginType);
}
}
示例2: GraphBuilder
public GraphBuilder(PluginGraph pluginGraph)
{
_pluginGraph = pluginGraph;
_assemblyScanner = new AssemblyScanner();
_instanceReader = new XmlInstanceReader(_pluginGraph.Log, new Registry());
}
示例3: PluginGraphBuilder
public PluginGraphBuilder(ConfigurationParser[] parsers, Registry[] registries, GraphLog log)
{
_parsers = parsers;
_registries = registries;
_graph = new PluginGraph();
_graph.Log = log;
}
示例4: transient_cache_of_nested_pipeline_graph_is_a_stateful_cache
public void transient_cache_of_nested_pipeline_graph_is_a_stateful_cache()
{
var plugins = new PluginGraph();
var pipeline = PipelineGraph.BuildRoot(plugins);
pipeline.ToNestedGraph().Transients.ShouldBeOfType<LifecycleObjectCache>();
}
示例5: Read_in_a_class_with_primitive_arrays
public void Read_in_a_class_with_primitive_arrays()
{
string xml = @"
<Instance>
<numbers Values='1,2,3'/>
<strings Values='1,2,3'/>
</Instance>
";
XmlElement element = DataMother.BuildDocument(xml).DocumentElement;
element.SetAttribute("PluggedType", typeof (ClassWithStringAndIntArray).AssemblyQualifiedName);
var memento = new XmlAttributeInstanceMemento(element);
var graph = new PluginGraph();
Instance instance = memento.ReadInstance(typeof (ClassWithStringAndIntArray));
Assert.Fail("NWO");
// var theObject = (ClassWithStringAndIntArray) instance.Build(typeof (ClassWithStringAndIntArray),
// BuildSession.ForPluginGraph(graph));
//
// theObject.Numbers.ShouldEqual(new[] {1, 2, 3});
// theObject.Strings.ShouldEqual(new[] {"1", "2", "3"});
//
// Debug.WriteLine(theObject.GetType().AssemblyQualifiedName);
}
示例6: Apply
public void Apply(PluginGraph graph)
{
var registry = new Registry();
_interfaces.Each(@interface =>
{
var expression = registry.For(@interface);
ConfigureFamily(expression);
var exactMatches = _concretions.Where(x => x.CanBeCastTo(@interface)).ToArray();
if (exactMatches.Length == 1)
{
expression.Use(exactMatches.Single());
}
else
{
exactMatches.Each(type => expression.Add(type));
}
if ([email protected]())
{
addConcretionsThatCouldBeClosed(@interface, expression);
}
});
_concretions.Each(t => graph.ConnectedConcretions.Fill(t));
registry.As<IPluginGraphConfiguration>().Configure(graph);
}
示例7: Process
public void Process(Type type, PluginGraph graph)
{
if (!IsConcrete(type)) return;
if (type.Name.EndsWith("Actor") && type.Implements<AsyncHttpActor>())
graph.AddType(typeof(AsyncHttpActor), type);
}
示例8: build_root_for_tracked_transients
public void build_root_for_tracked_transients()
{
var pluginGraph = new PluginGraph { TransientTracking = TransientTracking.ExplicitReleaseMode };
var graph = PipelineGraph.BuildRoot(pluginGraph);
graph.Transients.ShouldBeOfType<TrackingTransientCache>();
}
示例9: NewChild
public IPipelineGraph NewChild()
{
var childGraph = new PluginGraph();
var instances = new ComplexInstanceGraph(_root, childGraph, ContainerRole.ProfileOrChild);
return new PipelineGraph(childGraph, instances, _root, _root.Singletons, _root.Transients);
}
示例10: Seal_does_not_throw_an_exception_if_there_are_no_errors
public void Seal_does_not_throw_an_exception_if_there_are_no_errors()
{
var graph = new PluginGraph();
Assert.AreEqual(0, graph.Log.ErrorCount);
graph.Seal();
}
示例11: ThrowIfMarkerInterfaceIsRegistered
private static void ThrowIfMarkerInterfaceIsRegistered(PluginGraph graph)
{
if (graph.HasFamily<IMarkerInterface>())
{
throw new InvalidOperationException("Populate should only be called once per container.");
}
}
开发者ID:structuremap,项目名称:StructureMap.Microsoft.DependencyInjection,代码行数:7,代码来源:ContainerExtensions.cs
示例12: AssertErrors_throws_StructureMapConfigurationException_if_there_is_an_error
public void AssertErrors_throws_StructureMapConfigurationException_if_there_is_an_error()
{
var graph = new PluginGraph();
graph.Log.RegisterError(400, new ApplicationException("Bad!"));
graph.Log.AssertFailures();
}
示例13: addCloseGenericPolicyTo
private void addCloseGenericPolicyTo(PluginGraph graph)
{
var policy = new CloseGenericFamilyPolicy(graph);
graph.AddFamilyPolicy(policy);
graph.Profiles.Each(addCloseGenericPolicyTo);
}
示例14: PluginFamily
public PluginFamily(Type pluginType, PluginGraph parent)
{
_parent = parent;
_pluginType = pluginType;
PluginFamilyAttribute.ConfigureFamily(this);
}
示例15: build_root_for_default_tracking_style
public void build_root_for_default_tracking_style()
{
var pluginGraph = new PluginGraph {TransientTracking = TransientTracking.DefaultNotTrackedAtRoot};
var graph = PipelineGraph.BuildRoot(pluginGraph);
graph.Transients.ShouldBeOfType<NulloTransientCache>();
}