コード例 #1
0
 internal void ValidateNameIsLegal(ValidationContext context)
 {
     if (!DataFormats.IsValidCSharpIdentifier(this.Name))
     {
         context.LogError(
             string.Format(CultureInfo.CurrentCulture, Properties.Resources.Validate_NamedElementNameNotValid, this.Name),
             Properties.Resources.Validate_NamedElementNameNotValidCode, this);
     }
 }
コード例 #2
0
        internal void ValidateCodeIdentifierIsLegal(ValidationContext context)
        {
            try
            {
                if (!DataFormats.IsValidCSharpIdentifier(this.CodeIdentifier))
                {
                    context.LogError(
                        string.Format(CultureInfo.CurrentCulture, Properties.Resources.Validate_NamedElementCodeIdentifierNotValid, this.Name),
                        Properties.Resources.Validate_NamedElementCodeIdentifierNotValidCode, this);
                }
            }
            catch (Exception ex)
            {
                tracer.Error(
                    ex,
                    Properties.Resources.ValidationMethodFailed_Error,
                    Reflector <NamedElementSchema> .GetMethod(n => n.ValidateCodeIdentifierIsLegal(context)).Name);

                throw;
            }
        }