コード例 #1
0
        public static PartConventionBuilder <PartConvention> ForTypesAssignableFrom <T>(
            this PartConventionBuilder <PartConvention> builder)
        {
            Predicate <Type> condition =
                t => typeof(T).IsAssignableFrom(t) && !t.IsInterface && t.IsPublic;

            builder.ProvideValueFor(x => x.Condition, condition);

            return(builder);
        }
コード例 #2
0
        public static PartConventionBuilder <PartConvention> ForType <T>(
            this PartConventionBuilder <PartConvention> builder)
        {
            Predicate <Type> condition =
                t => typeof(T) == t;

            builder.ProvideValueFor(x => x.Condition, condition);

            return(builder);
        }
コード例 #3
0
        public static PartConventionBuilder <PartConvention> ForTypesWhereNamespaceContains(
            this PartConventionBuilder <PartConvention> builder, string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            Predicate <Type> condition =
                t => t.Namespace != null && t.Namespace.Contains(value) && !t.IsInterface && t.IsPublic;

            builder.ProvideValueFor(x => x.Condition, condition);

            return(builder);
        }
コード例 #4
0
        public static PartConventionBuilder <PartConvention> ForTypesWithName(
            this PartConventionBuilder <PartConvention> builder, string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            Predicate <Type> condition =
                t => t.Name.Equals(name) && !t.IsInterface && t.IsPublic;

            builder.ProvideValueFor(x => x.Condition, condition);

            return(builder);
        }