public ServiceFamily Build(Type type, ServiceGraph serviceGraph) { if (type.IsGenericTypeDefinition) { return(null); } if (!type.IsConcrete()) { return(null); } if (!IsReallyPublic(type)) { return(null); } if (serviceGraph.CouldBuild(type, out var message)) { return(new ServiceFamily(type, serviceGraph.DecoratorPolicies, new ConstructorInstance(type, type, ServiceLifetime.Transient))); } else { var empty = new ServiceFamily(type, new IDecoratorPolicy[0], new Instance[0]); empty.CannotBeResolvedMessage = message; return(empty); } return(null); }
internal void Inject(ObjectInstance instance) { if (_families.ContainsKey(instance.ServiceType)) { if (_families[instance.ServiceType].Append(instance, DecoratorPolicies) == AppendState.NewDefault) { _byType = _byType.Remove(instance.ServiceType); } } else { var family = new ServiceFamily(instance.ServiceType, DecoratorPolicies, instance); _families.Add(instance.ServiceType, family); } }
public ServiceFamilyConfiguration(ServiceFamily family, Scope scope) { _family = family; _scope = scope; }