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


C# FilterExpression.Include方法代码示例

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


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

示例1: AllowSome2DenySome2

        public void AllowSome2DenySome2()
        {
            var mockQuery = new MockQuery();
            var query = mockQuery.Query();

            var filterExpression = new FilterExpression<int>();
            filterExpression.Include(x1 => x1 >= 2);
            filterExpression.Include(x2 => x2 >= 4);
            filterExpression.Exclude(x3 => x3 >= 4);
            filterExpression.Exclude(x4 => x4 >= 5);
            var filteredQuery = GetOpt(filterExpression.GetFilter(), query);

            Assert.AreEqual(".Where(x1 => (((x1 >= 2) OrElse (x1 >= 4)) AndAlso (Not((x1 >= 4)) AndAlso Not((x1 >= 5)))))", mockQuery.GetWherePart(filteredQuery));
            Assert.AreEqual("2, 3", TestUtility.Dump(filteredQuery));
            Assert.AreEqual(1, mockQuery.CallCount);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:16,代码来源:FilterExpressionTest.cs

示例2: AllowAllDenySome2

        public void AllowAllDenySome2()
        {
            var mockQuery = new MockQuery();
            var query = mockQuery.Query();

            var filterExpression = new FilterExpression<int>();
            filterExpression.Include(x1 => true);
            filterExpression.Exclude(x2 => x2 > 2);
            filterExpression.Exclude(x3 => x3 < 2);
            var filteredQuery = GetOpt(filterExpression.GetFilter(), query);

            Assert.AreEqual(".Where(x2 => (Not((x2 > 2)) AndAlso Not((x2 < 2))))", mockQuery.GetWherePart(filteredQuery));
            Assert.AreEqual("2", TestUtility.Dump(filteredQuery));
            Assert.AreEqual(1, mockQuery.CallCount);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:15,代码来源:FilterExpressionTest.cs

示例3: AllowSome2DenyAll

        public void AllowSome2DenyAll()
        {
            var mockQuery = new MockQuery();
            var query = mockQuery.Query();

            var filterExpression = new FilterExpression<int>();
            filterExpression.Include(x1 => x1 >= 3);
            filterExpression.Exclude(x2 => true);
            var filteredQuery = GetOpt(filterExpression.GetFilter(), query);

            Assert.AreEqual("New query: System.Int32[]", mockQuery.GetWherePart(filteredQuery), "Result should be a newly constructed empty array");
            Assert.AreEqual("", TestUtility.Dump(filteredQuery));
            Assert.AreEqual(0, mockQuery.CallCount, "Empty filter should be optimized to not use original query.");
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:14,代码来源:FilterExpressionTest.cs

示例4: AllowSomeDenyNone

        public void AllowSomeDenyNone()
        {
            var mockQuery = new MockQuery();
            var query = mockQuery.Query();

            var filterExpression = new FilterExpression<int>();
            filterExpression.Include(x1 => x1 >= 3);
            filterExpression.Exclude(x2 => false);
            var filteredQuery = GetOpt(filterExpression.GetFilter(), query);

            Assert.AreEqual(".Where(x1 => (x1 >= 3))", mockQuery.GetWherePart(filteredQuery));
            Assert.AreEqual("3, 4", TestUtility.Dump(filteredQuery));
            Assert.AreEqual(1, mockQuery.CallCount);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:14,代码来源:FilterExpressionTest.cs

示例5: AllowAllDenyNone

        public void AllowAllDenyNone()
        {
            var mockQuery = new MockQuery();
            var query = mockQuery.Query();

            var filterExpression = new FilterExpression<int>();
            filterExpression.Include(x1 => true);
            filterExpression.Exclude(x2 => false);
            var filteredQuery = GetOpt(filterExpression.GetFilter(), query);

            Assert.AreEqual("", mockQuery.GetWherePart(filteredQuery), "Optimized - No where part");
            Assert.AreEqual("1, 2, 3, 4", TestUtility.Dump(filteredQuery));
            Assert.AreEqual(1, mockQuery.CallCount);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:14,代码来源:FilterExpressionTest.cs

示例6: AllowSome2

        public void AllowSome2()
        {
            var mockQuery = new MockQuery();
            var query = mockQuery.Query();

            var filterExpression = new FilterExpression<int>();
            filterExpression.Include(x1 => x1 >= 4);
            filterExpression.Include(x2 => x2 <= 2);
            var filteredQuery = GetOpt(filterExpression.GetFilter(), query);

            Assert.AreEqual(".Where(x1 => ((x1 >= 4) OrElse (x1 <= 2)))", mockQuery.GetWherePart(filteredQuery));
            Assert.AreEqual("1, 2, 4", TestUtility.DumpSorted(filteredQuery));
            Assert.AreEqual(1, mockQuery.CallCount);
        }
开发者ID:tjakopovic,项目名称:Rhetos,代码行数:14,代码来源:FilterExpressionTest.cs


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