/// <summary>
        /// Should a type be exported
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public virtual bool ShouldCreateConcreteStrategy(Type type)
        {
            if (type == typeof(string) || type.GetTypeInfo().IsPrimitive || type == typeof(DateTime))
            {
                return(false);
            }

            return(type.GetTypeInfo().DeclaredConstructors.Any(c => c.IsPublic && !c.IsStatic) &&
                   _filters.All(func => !func(type)));
        }
Exemple #2
0
        /// <summary>
        /// Should a type be exported
        /// </summary>
        /// <returns></returns>
        public virtual bool ShouldCreateConcreteStrategy(IActivationExpressionRequest request)
        {
            var type = request.ActivationType;

            if (type == typeof(string) || type.GetTypeInfo().IsPrimitive || type == typeof(DateTime))
            {
                return(false);
            }

            return(type.GetTypeInfo().DeclaredConstructors.Any(c => c.IsPublic && !c.IsStatic) &&
                   _filters.All(func => !func(type)));
        }
Exemple #3
0
        /// <summary>
        /// Should a type be exported
        /// </summary>
        /// <returns></returns>
        public virtual bool ShouldCreateConcreteStrategy(IActivationExpressionRequest request)
        {
            var type = request.ActivationType;

            if (type == typeof(string) ||
                type.GetTypeInfo().IsPrimitive)
            {
                return(false);
            }

            if (type.GetTypeInfo().IsValueType&&
                (type.Namespace == "System" || (type.Namespace?.StartsWith("System") ?? false)))
            {
                return(false);
            }

            if (type.IsConstructedGenericType && type.GetTypeInfo().GetGenericTypeDefinition() == typeof(Nullable <>))
            {
                return(false);
            }

            return(type.GetTypeInfo().DeclaredConstructors.Any(c => c.IsPublic && !c.IsStatic) &&
                   _filters.All(func => !func(type)));
        }