예제 #1
0
        public void Test()
        {
            var productList = _context.Product
                              .Where(p => AdventureWorksContext.GetStock(p.ProductId) > 4)
                              .ToList();

            Assert.Equal(191, productList.Count);
        }
예제 #2
0
        public void ShouldUseDbFunctionsInLinq()
        {
            //Notice the static method GetStock AdventureWorksContext.partial
            //that makes this work by mapping the function in the database

            //This makes the query use a database function so nothing is evaluated client-side

            var prodList = _context.Product
                           .Where(p => AdventureWorksContext.GetStock(p.ProductId) > 4).ToList();

            Assert.Equal(191, prodList.Count);
        }