• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ISpecificationBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ISpecificationBuilder的典型用法代码示例。如果您正苦于以下问题:C# ISpecificationBuilder类的具体用法?C# ISpecificationBuilder怎么用?C# ISpecificationBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ISpecificationBuilder类属于命名空间,在下文中一共展示了ISpecificationBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Process

 public override void Process(IReflector reflector, PropertyInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (method.PropertyType.IsAssignableFrom(typeof(ContactType))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(AddressType))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ContactType))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(Culture))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(SalesReason))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(UnitMeasure))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ScrapReason))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ProductSubcategory))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
     if (method.PropertyType.IsAssignableFrom(typeof(ProductCategory))) {
         FacetUtils.AddFacet(new NotNavigableFacet(specification));
     }
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:29,代码来源:AWNotNavigableFacetFactory.cs


示例2: Process

 public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if ((method.ReturnType.IsPrimitive || TypeUtils.IsEnum(method.ReturnType)) && method.GetCustomAttribute<OptionallyAttribute>() != null) {
         Log.Warn("Ignoring Optionally annotation on primitive parameter on " + method.ReflectedType + "." + method.Name);
         return;
     }
     Process(method, specification);
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:7,代码来源:OptionalAnnotationFacetFactory.cs


示例3: ProcessParams

 public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     if (TypeUtils.IsString(parameter.ParameterType)) {
         var attribute = parameter.GetCustomAttribute<MultiLineAttribute>();
         FacetUtils.AddFacet(Create(attribute, holder));
     }
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:7,代码来源:MultiLineAnnotationFacetFactory.cs


示例4: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder spec) {
     var attr = type.GetCustomAttribute<NakedObjectsTypeAttribute>();
     if (attr == null) {
         RemoveExplicitlyIgnoredMembers(type, methodRemover);
     } else {
         switch (attr.ReflectionScope) {
             case ReflectOver.All:
                 RemoveExplicitlyIgnoredMembers(type, methodRemover);
             break;
             case ReflectOver.TypeOnlyNoMembers:
                 foreach (MethodInfo method in type.GetMethods()) {
                     methodRemover.RemoveMethod(method);
                 }
                 break;
             case ReflectOver.ExplicitlyIncludedMembersOnly:
                 foreach (MethodInfo method in type.GetMethods()) {
                     if (method.GetCustomAttribute<NakedObjectsIncludeAttribute>() == null) {
                         methodRemover.RemoveMethod(method);
                     }
                 }
                 break;
             case ReflectOver.None:
                 throw new ReflectionException("Attempting to introspect a class that has been marked with NakedObjectsType with ReflectOver.None");
             default:
                 throw new ReflectionException(String.Format("Unhandled value for ReflectOver: {0}", attr.ReflectionScope));
         }
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:28,代码来源:RemoveIgnoredMethodsFacetFactory.cs


示例5: Process

        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            IFacet facet = null;

            if (!type.IsInterface && typeof (IViewModel).IsAssignableFrom(type)) {
                MethodInfo deriveMethod = type.GetMethod("DeriveKeys", new Type[] {});
                MethodInfo populateMethod = type.GetMethod("PopulateUsingKeys", new[] {typeof (string[])});

                var toRemove = new List<MethodInfo> {deriveMethod, populateMethod};

                if (typeof (IViewModelEdit).IsAssignableFrom(type)) {
                    facet = new ViewModelEditFacetConvention(specification);
                }
                else if (typeof (IViewModelSwitchable).IsAssignableFrom(type)) {
                    MethodInfo isEditViewMethod = type.GetMethod("IsEditView");
                    toRemove.Add(isEditViewMethod);
                    facet = new ViewModelSwitchableFacetConvention(specification);
                }
                else {
                    facet = new ViewModelFacetConvention(specification);
                }
                methodRemover.RemoveMethods(toRemove.ToArray());
            }

            FacetUtils.AddFacet(facet);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:25,代码来源:ViewModelFacetFactory.cs


示例6: Process

 public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (CollectionUtils.IsCollectionButNotArray(property.PropertyType)) {
         specification.AddFacet(new CollectionResetFacet(property, specification));
     }
     else {
         base.Process(reflector, property, methodRemover, specification);
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:CollectionFacetFactory.cs


示例7: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     FacetUtils.AddFacets(
         new IFacet[] {
             new DescribedAsFacetNone(specification),
             new ImmutableFacetNever(specification),
             new TitleFacetNone(specification)
         });
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:FallbackFacetFactory.cs


示例8: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (typeof (IEnumerable).IsAssignableFrom(type) && !TypeUtils.IsSystem(type)) {
         MethodInfo method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.GetEnumeratorMethod, null, Type.EmptyTypes);
         if (method != null) {
             methodRemover.RemoveMethod(method);
         }
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:8,代码来源:IteratorFilteringFacetFactory.cs


示例9: ProcessParams

        public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
            ParameterInfo parameter = method.GetParameters()[paramNum];

            if (IsDatetimeOrNullableDateTime(parameter.ParameterType)) {
                var dataTypeAttribute = parameter.GetCustomAttribute<DataTypeAttribute>();
                var concurrencyCheckAttribute = parameter.GetCustomAttribute<ConcurrencyCheckAttribute>();
                FacetUtils.AddFacet(Create(dataTypeAttribute, concurrencyCheckAttribute, holder));
            }
        }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:9,代码来源:DateOnlyFacetFactory.cs


示例10: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     Type currentType = type;
     while (currentType != null) {
         if (TypeUtils.IsSystem(currentType)) {
             ProcessSystemType(currentType, methodRemover, specification);
         }
         currentType = currentType.BaseType;
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:9,代码来源:RemoveSuperclassMethodsFacetFactory.cs


示例11: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     if (IsDynamicProxyType(type)) {
         foreach (MethodInfo method in type.GetMethods().Join(MethodsToRemove, mi => mi.Name, s => s, (mi, s) => mi)) {
             if (methodRemover != null && method != null) {
                 methodRemover.RemoveMethod(method);
             }
         }
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:9,代码来源:RemoveDynamicProxyMethodsFacetFactory.cs


示例12: Process

        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            var facets = new List<IFacet> {
                new TypeIsAbstractFacet(specification, IsAbstract(type)),
                new TypeIsInterfaceFacet(specification, IsInterface(type)),
                new TypeIsSealedFacet(specification, IsSealed(type)),
                new TypeIsVoidFacet(specification, IsVoid(type))
            };

            FacetUtils.AddFacets(facets);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:10,代码来源:TypeMarkerFacetFactory.cs


示例13: Process

        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            if (typeof (Enum).IsAssignableFrom(type)) {
                Type semanticsProviderType = typeof (EnumValueSemanticsProvider<>).MakeGenericType(type);
                var spec = reflector.LoadSpecification<IObjectSpecImmutable>(type);
                object semanticsProvider = Activator.CreateInstance(semanticsProviderType, spec, specification);

                MethodInfo method = typeof (ValueUsingValueSemanticsProviderFacetFactory).GetMethod("AddValueFacets", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(type);
                method.Invoke(null, new[] {semanticsProvider, specification});
            }
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:10,代码来源:EnumValueTypeFacetFactory.cs


示例14: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     MethodInfo method = FindMethod(reflector, type, MethodType.Class, RecognisedMethodsAndPrefixes.MenuMethod, null, null);
     if (method != null) {
         RemoveMethod(methodRemover, method);
         FacetUtils.AddFacet(new MenuFacetViaMethod(method, specification));
     }
     else {
         FacetUtils.AddFacet(new MenuFacetDefault(specification));
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:10,代码来源:MenuFacetFactory.cs


示例15: ProcessParams

 public override void ProcessParams(IReflector reflector, MethodInfo method, int paramNum, ISpecificationBuilder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     if (parameter.ParameterType.IsPrimitive || TypeUtils.IsEnum(parameter.ParameterType)) {
         if (method.GetCustomAttribute<OptionallyAttribute>() != null) {
             Log.Warn("Ignoring Optionally annotation on primitive parameter " + paramNum + " on " + method.ReflectedType + "." + method.Name);
         }
         return;
     }
     var attribute = parameter.GetCustomAttribute<OptionallyAttribute>();
     FacetUtils.AddFacet(Create(attribute, holder));
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:11,代码来源:OptionalAnnotationFacetFactory.cs


示例16: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     MethodInfo method = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.IconNameMethod, typeof (string), Type.EmptyTypes);
     var attribute = type.GetCustomAttribute<IconNameAttribute>();
     if (method != null) {
         RemoveMethod(methodRemover, method);
         FacetUtils.AddFacet(new IconFacetViaMethod(method, specification, attribute == null ? null : attribute.Value));
     }
     else {
         FacetUtils.AddFacet(Create(attribute, specification));
     }
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:11,代码来源:IconMethodFacetFactory.cs


示例17: Process

        public override void Process(IReflector reflector, MethodInfo method, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            Type declaringType = method.DeclaringType;
            var classAttribute = declaringType.GetCustomAttribute<AuthorizeActionAttribute>();
            var methodAttribute = method.GetCustomAttribute<AuthorizeActionAttribute>();

            if (classAttribute != null && methodAttribute != null) {
                string declaringTypeName = declaringType == null ? "Unknown Type" : declaringType.FullName;
                Log.WarnFormat("Class and method level AuthorizeAttributes applied to class {0} - ignoring attribute on method {1}", declaringTypeName, method.Name);
            }

            Create(classAttribute ?? methodAttribute, specification);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:12,代码来源:AuthorizeAnnotationFacetFactory.cs


示例18: Process

 public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
     try {
         foreach (string methodName in FixedPrefixes) {
             MethodInfo methodInfo = FindMethod(reflector, type, MethodType.Object, methodName, typeof (string), Type.EmptyTypes);
             if (methodInfo != null) {
                 methodRemover.RemoveMethod(methodInfo);
             }
         }
     }
     catch (Exception e) {
         Log.Error("Unexpected exception", e);
     }
 }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:13,代码来源:DisableDefaultMethodFacetFactory.cs


示例19: Process

        /// <summary>
        ///     If no title or ToString can be used then will use Facets provided by
        ///     <see cref="FallbackFacetFactory" /> instead.
        /// </summary>
        public override void Process(IReflector reflector, Type type, IMethodRemover methodRemover, ISpecificationBuilder specification) {
            IList<MethodInfo> attributedMethods = new List<MethodInfo>();
            foreach (PropertyInfo propertyInfo in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
                if (propertyInfo.GetCustomAttribute<TitleAttribute>() != null) {
                    if (attributedMethods.Count > 0) {
                        Log.Warn("Title annotation is used more than once in " + type.Name + ", this time on property " + propertyInfo.Name + "; this will be ignored");
                    }
                    attributedMethods.Add(propertyInfo.GetGetMethod());
                }
            }

            if (attributedMethods.Count > 0) {
                // attributes takes priority
                FacetUtils.AddFacet(new TitleFacetViaProperty(attributedMethods.First(), specification));
                return;
            }

            try {
                MethodInfo titleMethod = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.TitleMethod, typeof (string), Type.EmptyTypes);
                IFacet titleFacet = null;

                if (titleMethod != null) {
                    methodRemover.RemoveMethod(titleMethod);
                    titleFacet = new TitleFacetViaTitleMethod(titleMethod, specification);
                }

                MethodInfo toStringMethod = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.ToStringMethod, typeof (string), Type.EmptyTypes);
                if (toStringMethod != null && !(toStringMethod.DeclaringType == typeof (object))) {
                    methodRemover.RemoveMethod(toStringMethod);
                }
                else {
                    // on object do not use 
                    toStringMethod = null;
                }

                MethodInfo maskMethod = FindMethod(reflector, type, MethodType.Object, RecognisedMethodsAndPrefixes.ToStringMethod, typeof(string), new[] { typeof(string) });

                if (maskMethod != null) {
                    methodRemover.RemoveMethod(maskMethod);
                }

                if (titleFacet == null && toStringMethod != null) {
                    titleFacet = new TitleFacetViaToStringMethod(maskMethod, specification);
                }

                FacetUtils.AddFacet(titleFacet);
            }
            catch (Exception e) {
                Log.Warn("Unexpected Exception", e);
            }
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:55,代码来源:TitleMethodFacetFactory.cs


示例20: Process

        public override void Process(IReflector reflector, PropertyInfo property, IMethodRemover methodRemover, ISpecificationBuilder collection) {
            string capitalizedName = property.Name;
            Type type = property.DeclaringType;

            var facets = new List<IFacet> {new PropertyAccessorFacet(property, collection)};

            AddSetFacet(facets, property, collection);

            AddHideForSessionFacetNone(facets, collection);
            AddDisableFacetAlways(facets, collection);
            FindDefaultHideMethod(reflector, facets, methodRemover, property.DeclaringType, MethodType.Object, "PropertyDefault", collection);
            FindAndRemoveHideMethod(reflector, facets, methodRemover, type, MethodType.Object, capitalizedName, collection);
            FacetUtils.AddFacets(facets);
        }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:14,代码来源:CollectionFieldMethodsFacetFactory.cs



注:本文中的ISpecificationBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISpecimenBuilder类代码示例发布时间:2022-05-24
下一篇:
C# ISpecificationAttributeService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap