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); }
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); }
/// <summary> /// Add configuration to a PluginGraph with the Registry DSL /// </summary> /// <param name = "action"></param> public void Configure(Action <Registry> action) { var registry = new Registry(); action(registry); registry.As <IPluginGraphConfiguration>().Configure(this); }
public void ScanForTypes(TypePool types, PluginGraph pluginGraph) { var registry = new Registry(); types.For(_assemblies, _filter).Each( type => _conventions.Each(c => c.Process(type, registry))); registry.As <IPluginGraphConfiguration>().Configure(pluginGraph); _postScanningActions.Each(x => x(pluginGraph)); }
public void ScanForTypes(PluginGraph pluginGraph) { var registry = new Registry(); TypeRepository.FindTypes(_assemblies, TypeClassification.All, _filter.Matches) .ContinueWith(t => { t.Result.Each(type => _conventions.Each(c => c.Process(type, registry))); }).Wait(); registry.As <IPluginGraphConfiguration>().Configure(pluginGraph); _postScanningActions.Each(x => x(pluginGraph)); }
public void Apply(PluginGraph graph) { var registry = new Registry(); _interfaces.Each(@interface => { var expression = registry.For(@interface); ConfigureFamily(expression); _concretions.Where(x => x.CanBeCastTo(@interface)).Each(type => expression.Add(type)); }); registry.As <IPluginGraphConfiguration>().Configure(graph); }
public void Apply(PluginGraph graph) { var registry = new Registry(); _interfaces.Each(@interface => { var expression = registry.For(@interface); ConfigureFamily(expression); _concretions.Where(x => x.CanBeCastTo(@interface)).Each(type => expression.Add(type)); }); registry.As<IPluginGraphConfiguration>().Configure(graph); }
public void Process_to_PluginGraph() { var graph = new PluginGraph(); var scanner = new DefaultConventionScanner(); var registry = new Registry(); scanner.Process(typeof(Convention), registry); registry.As <IPluginGraphConfiguration>().Configure(graph); graph.Families.Has(typeof(IServer)).ShouldBeFalse(); graph.Families.Has(typeof(IConvention)).ShouldBeTrue(); var family = graph.Families[typeof(IConvention)]; family.Instances.Count().ShouldBe(1); }
/// <summary> /// Add configuration to a PluginGraph with the Registry DSL /// </summary> /// <param name = "action"></param> public void Configure(Action<Registry> action) { var registry = new Registry(); action(registry); registry.As<IPluginGraphConfiguration>().Configure(this); }
public void Process_to_PluginGraph() { var graph = new PluginGraph(); var scanner = new DefaultConventionScanner(); var registry = new Registry(); scanner.Process(typeof (Convention), registry); registry.As<IPluginGraphConfiguration>().Configure(graph); graph.Families.Has(typeof (IServer)).ShouldBeFalse(); graph.Families.Has(typeof (IConvention)).ShouldBeTrue(); var family = graph.Families[typeof (IConvention)]; family.Instances.Count().ShouldBe(1); }