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


C# IContextExpression类代码示例

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


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

示例1: DataBoundAssertion

        protected DataBoundAssertion(IContextExpression expression)
        {
            if (expression == null) 
                throw new ArgumentNullException("expression");

            _expression = expression;
        }
开发者ID:elmah,项目名称:Elmah,代码行数:7,代码来源:DataBoundAssertion.cs

示例2: RegexMatchAssertion

        public RegexMatchAssertion(IContextExpression source, Regex regex)
            : base(source)
        {
            if (regex == null)
                throw new ArgumentNullException("regex");

            _regex = regex;
        }
开发者ID:k4gdw,项目名称:ELMAH,代码行数:8,代码来源:RegexMatchAssertion.cs

示例3: TypeAssertion

        public TypeAssertion(IContextExpression source, Type expectedType, bool byCompatibility)
            : base(MaskNullExpression(source))
        {
            if (expectedType == null)
                throw new ArgumentNullException("expectedType");

            if (expectedType.IsInterface || (expectedType.IsClass && expectedType.IsAbstract))
            {
                //
                // Interfaces and abstract classes will always have an
                // ancestral relationship.
                //

                byCompatibility = true;
            }

            _expectedType = expectedType;
            _byCompatibility = byCompatibility;
        }
开发者ID:kjana83,项目名称:ELMAH,代码行数:19,代码来源:TypeAssertion.cs

示例4: ComparisonAssertion

        public ComparisonAssertion(Predicate<int> predicate, IContextExpression source, TypeCode type, string value)
            : base(source)
        {
            if (predicate == null)
                throw new ArgumentNullException("predicate");

            _predicate = predicate;

            if (type == TypeCode.DBNull
                || type == TypeCode.Empty
                || type == TypeCode.Object)
            {
                string message = string.Format(
                    "The {0} value type is invalid for a comparison.", type.ToString());
                throw new ArgumentException(message, "type");
            }

            //
            // Convert the expected value to the comparison type and
            // save it as a field.
            //

            _expectedValue = Convert.ChangeType(value, type/*, FIXME CultureInfo.InvariantCulture */);
        }
开发者ID:stewart-rae,项目名称:Elmah,代码行数:24,代码来源:ComparisonAssertion.cs

示例5: IsNullAssertion

 public IsNullAssertion(IContextExpression expression)
     : base(expression)
 {
 }
开发者ID:k4gdw,项目名称:ELMAH,代码行数:4,代码来源:IsNullAssertion.cs

示例6: MaskNullExpression

 private static IContextExpression MaskNullExpression(IContextExpression expression)
 {
     return expression != null
          ? expression
          : new DelegatedContextExpression(new ContextExpressionEvaluationHandler(EvaluateToException));
 }
开发者ID:kjana83,项目名称:ELMAH,代码行数:6,代码来源:TypeAssertion.cs

示例7: MaskNullExpression

 private static IContextExpression MaskNullExpression(IContextExpression expression)
 {
     return expression ?? new DelegatedContextExpression(EvaluateToException);
 }
开发者ID:ramsenthil18,项目名称:elmah,代码行数:4,代码来源:TypeAssertion.cs

示例8: assert_is_type_compatible

 public static IAssertion assert_is_type_compatible(IContextExpression binding, Type type)
 {
     return new TypeAssertion(binding, type, /* byCompatibility */ true);
 }
开发者ID:boena,项目名称:elmah-with-custom-data,代码行数:4,代码来源:AssertionFactory.cs

示例9: assert_is_null

 public static IAssertion assert_is_null(IContextExpression binding)
 {
     return new IsNullAssertion(binding);
 }
开发者ID:boena,项目名称:elmah-with-custom-data,代码行数:4,代码来源:AssertionFactory.cs

示例10: assert_is_not_null

 public static IAssertion assert_is_not_null(IContextExpression binding)
 {
     return new UnaryNotAssertion(assert_is_null(binding));
 }
开发者ID:boena,项目名称:elmah-with-custom-data,代码行数:4,代码来源:AssertionFactory.cs

示例11: assert_greater_or_equal

 public static IAssertion assert_greater_or_equal(IContextExpression binding, TypeCode type, string value)
 {
     return new ComparisonAssertion(ComparisonResults.GreaterOrEqual, binding, type, value);
 }
开发者ID:boena,项目名称:elmah-with-custom-data,代码行数:4,代码来源:AssertionFactory.cs

示例12: assert_regex

        public static IAssertion assert_regex(IContextExpression binding, string pattern, bool caseSensitive, bool dontCompile)
        {
            if ((pattern ?? string.Empty).Length == 0)
                return StaticAssertion.False;

            //
            // NOTE: There is an assumption here that most uses of this
            // assertion will be for culture-insensitive matches. Since
            // it is difficult to imagine all the implications of involving
            // a culture at this point, it seems safer to just err with the
            // invariant culture settings.
            //

            var options = RegexOptions.CultureInvariant;

            if (!caseSensitive)
                options |= RegexOptions.IgnoreCase;

            if (!dontCompile)
                options |= RegexOptions.Compiled;

            return new RegexMatchAssertion(binding, new Regex(pattern, options));
        }
开发者ID:boena,项目名称:elmah-with-custom-data,代码行数:23,代码来源:AssertionFactory.cs

示例13: assert_not_equal

 public static IAssertion assert_not_equal(IContextExpression binding, TypeCode type, string value)
 {
     return new UnaryNotAssertion(assert_equal(binding, type, value));
 }
开发者ID:boena,项目名称:elmah-with-custom-data,代码行数:4,代码来源:AssertionFactory.cs

示例14: assert_lesser

 public static IAssertion assert_lesser(IContextExpression binding, TypeCode type, string value)
 {
     return new ComparisonAssertion(ComparisonResults.Lesser, binding, type, value);
 }
开发者ID:boena,项目名称:elmah-with-custom-data,代码行数:4,代码来源:AssertionFactory.cs


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