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


C# PropertyInfo.Is方法代码示例

本文整理汇总了C#中System.Reflection.PropertyInfo.Is方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyInfo.Is方法的具体用法?C# PropertyInfo.Is怎么用?C# PropertyInfo.Is使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.PropertyInfo的用法示例。


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

示例1: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Name) && Name != scriptParameter.Name)
                return ValidationMessage._0ShouldBe12.NiceToString(pi.NiceName(), ComparisonType.EqualTo.NiceToString(), scriptParameter.Name);

            if (pi.Is(() => Value))
            {
                return ScriptParameter.Valdidate(this.Value, this.ScriptParameter.GetToken(this.ParentChart));
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:12,代码来源:ChartParameter.cs

示例2: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => EachMinutes))
            {
                if ((60 % EachMinutes) != 0)
                    return SchedulerMessage._0IsNotMultiple1.NiceToString().FormatWith(pi.NiceName(), 60);
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:10,代码来源:ScheduleRule.cs

示例3: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Title) && string.IsNullOrEmpty(title))
            {
                if (content != null && content.RequiresTitle)
                    return DashboardMessage.DashboardDN_TitleMustBeSpecifiedFor0.NiceToString().FormatWith(content.GetType().NicePluralName());
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:10,代码来源:PanelPart.cs

示例4: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Cultures))
            {
                var error = Cultures.GroupBy(a => a.Culture).Where(a => a.Count() > 1).ToString(a => a.Key.ToString(), ", ");

                if (error.HasText())
                    return TranslationMessage.RepeatedCultures0.NiceToString().FormatWith(error); 
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:12,代码来源:TranslatorUser.cs

示例5: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => RowId) && PropertyRoute != null)
            {
                if (RowId == null && PropertyRoute.Path.Contains("/"))
                    return "{0} should be set for route {1}".FormatWith(pi.NiceName(), PropertyRoute);

                if (RowId != null && !PropertyRoute.Path.Contains("/"))
                    return "{0} should be null for route {1}".FormatWith(pi.NiceName(), PropertyRoute);
            }

            return null;
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:13,代码来源:TranslatedInstance.cs

示例6: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(()=>Holidays) && holidays != null)
            {
                string rep = (from h in holidays
                              group 1 by h.Date into g
                              where g.Count() > 2
                              select new { Date = g.Key, Num = g.Count() }).ToString(g => "{0} ({1})".FormatWith(g.Date, g.Num), ", ");

                if (rep.HasText())
                    return "Some dates have been repeated: " + rep;
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:15,代码来源:HolidayCalendarEntity.cs

示例7: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Name) && Name.HasText())
            {
                try
                {
                    CultureInfo.GetCultureInfo(this.Name);
                }
                catch (CultureNotFoundException)
                {
                    return "'{0}' is not a valid culture name".FormatWith(Name);
                }
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:16,代码来源:CultureInfoEntity.cs

示例8: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Text) && !EmailMasterTemplateEntity.MasterTemplateContentRegex.IsMatch(Text))
            {
                throw new ApplicationException(EmailTemplateMessage.TheTextMustContain0IndicatingReplacementPoint.NiceToString().FormatWith("@[content]"));
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:9,代码来源:EmailMasterTemplate.cs

示例9: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Token))
            {
                if (Token == null && emailAddress.IsNullOrEmpty())
                    return EmailTemplateMessage.TokenOrEmailAddressMustBeSet.NiceToString();

                if (Token != null && !emailAddress.IsNullOrEmpty())
                    return EmailTemplateMessage.TokenAndEmailAddressCanNotBeSetAtTheSameTime.NiceToString();

                if (Token != null && Token.Token.Type != typeof(EmailOwnerData))
                    return EmailTemplateMessage.TokenMustBeA0.NiceToString(typeof(EmailOwnerData).NiceName());
            }
            
            return null;
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:16,代码来源:EmailTemplate.cs

示例10: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Token))
            {
                if (Token == null)
                    return !scriptColumn.IsOptional ? ChartMessage._0IsNotOptional.NiceToString().FormatWith(scriptColumn.DisplayName) : null;

                if (parentChart.GroupResults)
                {
                    if (scriptColumn.IsGroupKey)
                    {
                        if (Token.Token is AggregateToken)
                            return ChartMessage._0IsKeyBut1IsAnAggregate.NiceToString().FormatWith(scriptColumn.DisplayName, DisplayName);
                    }
                    else
                    {
                        if (!(Token.Token is AggregateToken))
                            return ChartMessage._0ShouldBeAnAggregate.NiceToString().FormatWith(scriptColumn.DisplayName, DisplayName);
                    }
                }
                else
                {
                    if (Token.Token is AggregateToken)
                        return ChartMessage._0IsAnAggregateButTheChartIsNotGrouping.NiceToString().FormatWith(DisplayName);
                }

                if (!ChartUtils.IsChartColumnType(token.Token, ScriptColumn.ColumnType))
                    return ChartMessage._0IsNot1.NiceToString().FormatWith(DisplayName, ScriptColumn.ColumnType);
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:32,代码来源:ChartColumn.cs

示例11: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Parameters) && Parameters != null && ChartScript != null)
            {
                try
                {
                    EnumerableExtensions.JoinStrict(
                        Parameters,
                        ChartScript.Parameters,
                        p => p.Name,
                        ps => ps.Name, 
                        (p, ps) => new { p, ps }, pi.NiceName());
                }
                catch (Exception e)
                {
                    return e.Message;
                }
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:21,代码来源:UserChart.cs

示例12: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => State))
            {
                if (anulationDate != null && state != UserState.Disabled)
                    return AuthMessage.TheUserStateMustBeDisabled.NiceToString();
            }

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:10,代码来源:User.cs

示例13: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => Template) && Template == null && Active)
                return ValidationMessage._0IsNotSet.NiceToString(pi.NiceName());

            return base.PropertyValidation(pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:7,代码来源:WordTemplate.cs

示例14: ChildPropertyValidation

        protected override string ChildPropertyValidation(ModifiableEntity sender, PropertyInfo pi)
        {
            if (sender is PanelPartEntity)
            {
                PanelPartEntity part = (PanelPartEntity)sender;

                if (pi.Is(() => part.StartColumn))
                {
                    if (part.StartColumn + part.Columns > 12)
                        return DashboardMessage.Part0IsTooLarge.NiceToString(part);

                    var other = parts.TakeWhile(p => p != part)
                        .FirstOrDefault(a => a.Row == part.Row && a.ColumnInterval().Overlap(part.ColumnInterval()));

                    if (other != null)
                        return DashboardMessage.Part0OverlapsWith1.NiceToString(part, other);
                }

                if (entityType != null && pi.Is(() => part.Content) && part.Content != null)
                {
                    var idents = GraphExplorer.FromRoot((Entity)part.Content).OfType<Entity>();

                    string errorsUserQuery = idents.OfType<IHasEntitytype>()
                        .Where(uc => uc.EntityType != null && !uc.EntityType.Is(EntityType))
                        .ToString(uc => DashboardMessage._0Is1InstedOf2In3.NiceToString(NicePropertyName(() => EntityType), uc.EntityType, entityType, uc),
                        "\r\n");

                    return errorsUserQuery.DefaultText(null);
                }
            }

            return base.ChildPropertyValidation(sender, pi);
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:33,代码来源:DashboardEntity.cs

示例15: PropertyValidation

        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Is(() => PostalCode))
            {
                if (string.IsNullOrEmpty(postalCode) && Country != "Ireland")
                    return Signum.Entities.ValidationMessage._0IsNotSet.NiceToString().FormatWith(pi.NiceName());
            }

            return null;
        }
开发者ID:problem001,项目名称:southwind,代码行数:10,代码来源:Address.cs


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