当前位置: 首页>>代码示例>>C#>>正文


C# AccessorDef类代码示例

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


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

示例1: resolveCreator

        private Func<ElementRequest, HtmlTag> resolveCreator(AccessorDef accessorDef)
        {
            TagBuilder initialCreator = null;

            _sources.FirstOrDefault(x =>
                {
                    var tagBuilder = x.CreateInitial(accessorDef);
                    if (tagBuilder == null) { return false; }
                    initialCreator = tagBuilder;
                    return true;
                });

            if (initialCreator == null)
            {
                throw new Exception(string.Format("Html Conventions have no tag builder for {0}.{1}",
                                                  accessorDef.ModelType.FullName, accessorDef.Accessor.Name));
            }

            TagModifier[] modifiers = (_modifiers).Select((x => x.CreateModifier(accessorDef))).Where((x => x != null)).ToArray();
            return (request =>
                {
                    HtmlTag tag = initialCreator(request);
                    foreach (TagModifier v in modifiers)
                    {
                        v(request, tag);
                    }
                    return tag;
                });
        }
开发者ID:reharik,项目名称:CCHtmlHelpers,代码行数:29,代码来源:TagFactory.cs

示例2: resolveCreator

 private Func<ElementRequest, HtmlTag> resolveCreator(AccessorDef accessorDef)
 {
     TagBuilder initialCreator = (_sources).FirstValue((x => x.CreateInitial(accessorDef)));
     if (initialCreator == null)
     {
         throw new FubuException(3000, "Html Conventions have no tag builder for {0}.{1}", new string[2]
                                                                                               {
                                                                                                   accessorDef.
                                                                                                       ModelType.
                                                                                                       FullName,
                                                                                                   accessorDef.
                                                                                                       Accessor.
                                                                                                       Name
                                                                                               });
     }
     else
     {
         TagModifier[] modifiers =
             (_modifiers).Select((x => x.CreateModifier(accessorDef))).Where((x => x != null)).ToArray();
         return (request =>
                     {
                         HtmlTag tag = initialCreator(request);
                         (modifiers).Each((x => x(request, tag)));
                         return tag;
                     });
     }
 }
开发者ID:reharik,项目名称:KnowYourTurf.SystemSupport,代码行数:27,代码来源:TagFactory.cs

示例3: CreateInitial

 public TagBuilder CreateInitial(AccessorDef accessorDef)
 {
     if (matches(accessorDef))
         return Build;
     else
         return null;
 }
开发者ID:reharik,项目名称:CannibalCoder,代码行数:7,代码来源:ElementBuilder.cs

示例4: CreateModifier

 public TagModifier CreateModifier(AccessorDef accessorDef)
 {
     if (accessorDef.Accessor.PropertyType == typeof(Int16)
         || accessorDef.Accessor.PropertyType == typeof(Int32)
         || accessorDef.Accessor.PropertyType == typeof(Int64)
         || accessorDef.Accessor.PropertyType == typeof(decimal)
         || accessorDef.Accessor.PropertyType == typeof(float)
         || accessorDef.Accessor.PropertyType == typeof(double)
         || accessorDef.Accessor.PropertyType.IsNullableOf(typeof(Int16))
         || accessorDef.Accessor.PropertyType.IsNullableOf(typeof(Int32))
         || accessorDef.Accessor.PropertyType.IsNullableOf(typeof(Int64))
         || accessorDef.Accessor.PropertyType.IsNullableOf(typeof(decimal))
         || accessorDef.Accessor.PropertyType.IsNullableOf(typeof(float))
         || accessorDef.Accessor.PropertyType.IsNullableOf(typeof(double)))
     {
         TagModifier modifier = (request, tag) =>
                                tag.AddValidationHelper(ValidationRule.Number + ":true",
                                                        ValidationRule.Number + ": '" +
                                                        CoreLocalizationKeys.FIELD_MUST_BE_NUMBER.ToFormat(
                                                            request.Accessor.FieldName.
                                                                ToSeperateWordsFromPascalCase()) + "'");
         return modifier;
     }
     return null;
 }
开发者ID:reharik,项目名称:MethodFitness,代码行数:25,代码来源:ValidationModifier.cs

示例5: matches

 protected override bool matches(AccessorDef def)
 {
     var propertyName = def.Accessor.FieldName;
     var listPropertyInfo = def.ModelType.GetProperty("_"+propertyName + "List");
     //            var readOnlyListPropertyInfo = def.ModelType.GetProperty(propertyName.Replace("ReadOnly", "") + "List");
     return (listPropertyInfo != null &&
             listPropertyInfo.PropertyType == typeof(GroupedSelectViewModel));
 }
开发者ID:reharik,项目名称:CannibalCoder,代码行数:8,代码来源:GroupedSelectBuilder2.cs

示例6: matches

 protected override bool matches(AccessorDef def)
 {
     return def.ModelType == typeof(ProjectListModel) ||
         def.ModelType == typeof(BoardConfigurationModel) ||
         def.ModelType == typeof(CardListModel) ||
         def.ModelType == typeof(TimeRecordListModel) ||
         def.ModelType == typeof(ProjectModel);
 }
开发者ID:rauhryan,项目名称:kokugen,代码行数:8,代码来源:BeforeEachOfPartialBuilder.cs

示例7: CreateModifier

 public TagModifier CreateModifier(AccessorDef accessorDef)
 {
     if (matches(accessorDef))
     {
         return Build;
     }
     return null;
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:8,代码来源:ElementModifier.cs

示例8: CreateModifier

 public TagModifier CreateModifier(AccessorDef accessorDef)
 {
     if (!accessorDef.Accessor.HasAttribute<ValidateNonEmptyAttribute>()) return null;
     TagModifier modifier = (request, tag) =>
                            tag.AddValidationHelper(ValidationRule.Required + ":true",
                                                    ValidationRule.Required + ": '" +
                                                    CoreLocalizationKeys.FIELD_REQUIRED.ToFormat(request.Accessor.FieldName.ToSeperateWordsFromPascalCase()) +"'");
     return modifier;
 }
开发者ID:reharik,项目名称:KnowYourTurf,代码行数:9,代码来源:ValidationModifier.cs

示例9: matches

        protected override bool matches(AccessorDef accessor)
        {
            var propertyType = accessor.Accessor.PropertyType;

            return propertyType == typeof (DateTime)
                   || propertyType == typeof (DateTime?)
                   || propertyType == typeof (Date)
                   || propertyType == typeof (Date?);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:9,代码来源:DateValidationModifier.cs

示例10: CreateModifier

	public TagModifier CreateModifier(AccessorDef accessorDef)
	{
		if (accessorDef.Accessor.Name.EndsWith("Email"))
		{
			return (req, tag) => { tag.Attr("type", "email"); };
		}

		return null;
	}
开发者ID:Linkgoron,项目名称:HtmlConventionDocs,代码行数:9,代码来源:EmailEditorModifier.cs

示例11: CreateInitial

        public TagBuilder CreateInitial(AccessorDef accessorDef)
        {
            if(accessorDef.ModelType.Equals(typeof(LoanNumber)))
            {
                return request =>
                {
                    var str = request.Value<LoanNumber>();
                    return new HtmlTag("span", tag=>tag.Text(str.ToString()));
                };
            }

            return a => { return HtmlTag.Empty(); };
        }
开发者ID:rauhryan,项目名称:awesomesauce,代码行数:13,代码来源:LoanNumberDisplayBuilder.cs

示例12: resolveCreator

        private Func<ElementRequest, HtmlTag> resolveCreator(AccessorDef accessorDef)
        {
            TagBuilder initialCreator = _sources.FirstValue(x => x.CreateInitial(accessorDef));
            TagModifier[] modifiers =
                _modifiers.Select(x => x.CreateModifier(accessorDef)).Where(x => x != null).ToArray();

            return request =>
            {
                HtmlTag tag = initialCreator(request);
                modifiers.Each(x => x(request, tag));

                return tag;
            };
        }
开发者ID:bbehrens,项目名称:fubumvc,代码行数:14,代码来源:TagFactory.cs

示例13: matches

        protected override bool matches(AccessorDef accessor)
        {
            var propertyType = accessor.Accessor.PropertyType;

            return propertyType == typeof (decimal)
                   || propertyType == typeof (decimal?)
                   || propertyType == typeof(int)
                   || propertyType == typeof(int?)
                   || propertyType == typeof(short)
                   || propertyType == typeof(short?)
                   || propertyType == typeof (float)
                   || propertyType == typeof (float?)
                   || propertyType == typeof (double)
                   || propertyType == typeof (double?)
                   || propertyType == typeof (long)
                   || propertyType == typeof (long?);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:17,代码来源:NumericValidationModifier.cs

示例14: CreateInitial

        public TagBuilder CreateInitial(AccessorDef accessorDef)
        {
            if (accessorDef.ModelType.Equals(typeof(LoanNumber)))
            {
                return request =>
                {
                    var str = request.Value<LoanNumber>().ToString();
                    var tag = new HtmlTag("input")
                        .Attr("type","text")
                        .Attr("value", str);

                    return tag;
                };
            }

            return a => { return HtmlTag.Empty(); };
        }
开发者ID:rauhryan,项目名称:awesomesauce,代码行数:17,代码来源:LoanNumberInputBuilder.cs

示例15: resolveCreator

        private Func<ElementRequest, int, int, HtmlTag> resolveCreator(AccessorDef accessorDef)
        {
            EachPartialTagBuilder initialCreator = _sources.FirstValue(x => x.CreateInitial(accessorDef));
            if (initialCreator == null)
            {
                throw new FubuException(3001, "Html Conventions have no tag builder for partials for {0}.{1}", accessorDef.ModelType.FullName, accessorDef.Accessor.Name);
            }

            EachPartialTagModifier[] modifiers =
                _modifiers.Select(x => x.CreateModifier(accessorDef)).Where(x => x != null).ToArray();

            return (request, index, count) =>
            {
                HtmlTag tag = initialCreator(request, index, count);
                modifiers.Each(x => x(request, tag, index, count));

                return tag;
            };
        }
开发者ID:roend83,项目名称:fubumvc,代码行数:19,代码来源:PartialTagFactory.cs


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