當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。