本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}