Example #1
0
        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);
        }
Example #2
0
        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))
            {
                return(new ServiceFamily(type, new ConstructorInstance(type, type, ServiceLifetime.Transient)));
            }

            return(null);
        }