public void finds_all() { theServices.AddTransient <IWidget, AWidget>(); theServices.AddSingleton(this); theServices.AddTransient <IGeneratedMethod, GeneratedMethod>(); theServices.AddTransient <IWidget, MoneyWidget>(); theGraph.FindAll(typeof(IWidget)) .Select(x => x.ImplementationType) .ShouldHaveTheSameElementsAs(typeof(AWidget), typeof(MoneyWidget)); }
protected override IEnumerable <Instance> createPlan(ServiceGraph services) { if (_inlines.Any()) { Elements = _inlines.ToArray(); } else { Elements = services.FindAll(typeof(T)); } return(Elements); }
public void finds_all() { theServices.AddTransient <IWidget, AWidget>(); theServices.AddSingleton(this); theServices.AddTransient <IThing, Thing>(); theServices.AddTransient <IWidget, MoneyWidget>(); var theGraph = new ServiceGraph(theServices, Scope.Empty()); theGraph.Initialize(); theGraph.FindAll(typeof(IWidget)) .OfType <ConstructorInstance>() .Select(x => x.ImplementationType) .ShouldHaveTheSameElementsAs(typeof(AWidget), typeof(MoneyWidget)); }
private void useInlineConstruction() { var variables = new ResolverVariables(_fields); foreach (var standin in _standins) { var variable = variables.Resolve(standin.Instance, BuildMode.Inline); standin.UseInner(variable); } variables.OfType <InjectedServiceField>().Each(field => { var family = _services.FindAll(field.VariableType); field.IsOnlyOne = family.Length == 1; }); }
public IEnumerable GetAllInstances(Type serviceType) { assertNotDisposed(); return(ServiceGraph.FindAll(serviceType).Select(x => x.Resolve(this)).ToArray()); }
public IReadOnlyList <T> GetAllInstances <T>() { assertNotDisposed(); return(ServiceGraph.FindAll(typeof(T)).Select(x => x.Resolve(this)).OfType <T>().ToList()); }
public IReadOnlyList <T> QuickBuildAll <T>() { assertNotDisposed(); return(ServiceGraph.FindAll(typeof(T)).Select(x => x.QuickResolve(this)).OfType <T>().ToList()); }
protected internal override IEnumerable <Instance> createPlan(ServiceGraph services) { _elements = services.FindAll(typeof(T)); return(_elements); }